πŸ–ŠοΈ SQL Query Editor

Write, format, and export SQL queries with one-click prettification.

SQL Input 13 lines Β· 268 chars

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, JOIN variants, 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 β€” AND and OR conditions are indented to align under the WHERE clause.

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 JOIN returns only matching rows; LEFT JOIN returns all rows from the left table even if there is no match.
  • WHERE β€” filters rows before grouping. Use AND / OR to combine conditions.
  • GROUP BY β€” groups rows sharing the same value in specified columns, enabling aggregate functions.
  • HAVING β€” filters groups after aggregation (like WHERE but for grouped results).
  • ORDER BY β€” sorts the result set. Add ASC (default) or DESC per column.
  • LIMIT / OFFSET β€” restricts the number of rows returned; useful for pagination.