SQL Formatter
Formats any SQL query with your desired indentation level, even if the statement is invalid. Change the case of keywords and identifiers.
About the SQL formatter
The formatter parses your statements and lays them out in the classic "river" style: each major clause (SELECT, FROM, WHERE, GROUP BY, ORDER BY, JOIN...) starts a new line and its content is indented underneath. All processing happens in your browser.
Supported statements
SELECT with joins, sub-queries, UNION, window functions and common table expressions (WITH), INSERT, UPDATE, DELETE, MERGE, CREATE / ALTER / DROP for tables, views and indexes, GRANT, transactions, and the procedural extensions of the selected dialect.
Options
| Option | Effect |
|---|---|
| Indentation level | Spaces (or a tab) added for every nesting level. |
| SQL keywords case | Rewrites reserved words and data types in upper or lower case. |
| Identifiers case | Rewrites unquoted table, column and alias names. |
| Blank lines between queries | Number of empty lines inserted after each ;. |
| AND / OR placement | Whether the logical operator starts or ends the new line. |