SQL Formatter
Format and beautify SQL queries with various styles and conventions
Raw SQL
Lines: 1 | Characters: 0
Formatted SQL
Lines: 0 | Characters: 0
Formatting Style
Standard
Balanced formatting with reasonable line breaks
Compact
Minimal whitespace, single-line when possible
Expanded
Maximum readability with extensive line breaks
Oracle Style
Oracle database conventions
MySQL Style
MySQL database conventions
PostgreSQL Style
PostgreSQL database conventions
SQL Server Style
Microsoft SQL Server conventions
Advanced Settings
Keyword Case
UPPERCASE
lowercase
Title Case
Indentation
Spaces
Tabs
Max Line Length
Break Before Keywords
Align Columns
Remove Comments
Show Statistics
SQL Examples
Basic SELECT
SELECT id, name, email FROM users WHERE active = 1 AND created_at > '2023-01-01'...
Complex JOIN
SELECT u.name, p.title, c.name as category FROM users u INNER JOIN posts p ON u....
Subquery
SELECT * FROM products WHERE price > (SELECT AVG(price) FROM products WHERE cate...
INSERT Statement
INSERT INTO users (name, email, password, created_at) VALUES ('John Doe', 'john@...
UPDATE with JOIN
UPDATE orders o JOIN customers c ON o.customer_id = c.id SET o.status = 'shipped...
CTE Query
WITH monthly_sales AS (SELECT DATE_FORMAT(created_at, '%Y-%m') as month, SUM(tot...
History