Pretty SQL Formatter

With Pretty SQL Formatter, prettify your SQL

Use this sql beautifier!

What is SQL?

SQL (Structured Query Language) is a standard programming language used for managing and manipulating relational databases. It is used to query, insert, update, and delete data within a database.

How to Use

  • Format: Format the SQL input. Or just press Enter(↵) key
  • Reset: Clear the input and output fields. Or just press Command(⌘)+Z
  • Copy: Copy the formatted SQL to the clipboard. Or just click output box to copy the result.

Sample SQL Data

Original SQL

SELECT name, age, city FROM users WHERE age > 30;

Formatted SQL

SELECT 
    name,
    age,
    city
FROM 
    users
WHERE 
    age > 30;

SQL Examples

-- Insert a new user
INSERT INTO users (name, age, city) VALUES ('Lee', 30, 'New York');

-- Update user age
UPDATE users SET age = 30 WHERE name = 'Lee';

-- Delete a user
DELETE FROM users WHERE name = 'Lee';

-- Select users with specific conditions
SELECT name, age FROM users WHERE city = 'New York' AND age >= 30;

-- Alter table to add a new column
ALTER TABLE employees ADD COLUMN department VARCHAR(100);

-- Drop the table
DROP TABLE employees;