🖊️ SQL Query Editor
Write, format, and export SQL queries with one-click prettification.
SQL Input 13 lines · 268 chars
Batch Format — Multiple Queries
About the SQL Query Editor
The SQL Query Editor is a browser-based editor for writing, formatting, and exporting SQL queries. It formats raw or minified SQL into clean, readable output with proper keyword casing and clause indentation — useful for reviewing AI-generated SQL, documenting queries, or preparing code for review.
How to use this tool
- Paste or type your SQL query in the SQL Input area.
- Click Format SQL to prettify the query: keywords are uppercased, major clauses are placed on new lines, and SELECT columns are each indented on their own line.
- Click Copy to copy the formatted result to your clipboard.
What the formatter does
- Keyword uppercasing — SQL keywords such as
SELECT,FROM,WHERE,JOIN,GROUP BY,ORDER BY,AND,OR,NULL, and aggregate functions are automatically uppercased. - Clause line breaks — each major clause (
SELECT,FROM,JOINvariants,WHERE,GROUP BY,ORDER BY,HAVING,LIMIT) is placed on its own line. - SELECT column indentation — each selected column is placed on a separate indented line for readability.
- WHERE condition indentation —
ANDandORconditions are indented to align under theWHEREclause.
SQL clause reference
SELECT— specifies the columns to return. Use*for all columns or list specific columns. Aggregate functions (COUNT,SUM,AVG,MIN,MAX) summarise data across rows.FROM— identifies the table(s) to query. Table aliases (e.g.,users u) shorten references.JOIN— combines rows from two tables.INNER JOINreturns only matching rows;LEFT JOINreturns all rows from the left table even if there is no match.WHERE— filters rows before grouping. UseAND/ORto combine conditions.GROUP BY— groups rows sharing the same value in specified columns, enabling aggregate functions.HAVING— filters groups after aggregation (likeWHEREbut for grouped results).ORDER BY— sorts the result set. AddASC(default) orDESCper column.LIMIT/OFFSET— restricts the number of rows returned; useful for pagination.
SysEmperor