Read the guide
Generate CREATE, INSERT, SELECT, UPDATE, and DELETE with correct quoting, then format the query so each clause is on its own line.
Format long SQL queries into readable, indented code with each clause on its own line. Pick your database dialect and keyword case.
.sql file.The query is split into tokens with the rules of the chosen dialect, so identifiers in backticks, brackets, or double quotes and dialect-specific operators are read correctly. Formatting uses the open-source sql-formatter library.
SELECT, FROM, WHERE, GROUP BY, ORDER BY, LIMIT) start at the left margin, and their contents are indented below them.AND/OR condition goes on its own line.CASE expressions are indented one more level.COUNT, and data types. Table names, column names, and string values keep their case.Input:
select u.id,u.email,count(o.id) as orders from users u left join orders o on o.user_id=u.id where u.active=1 group by u.id,u.email order by orders desc limit 10
Formatted with uppercase keywords and 2 spaces:
SELECT u.id, u.email, COUNT(o.id) AS orders FROM users u LEFT JOIN orders o ON o.user_id = u.id WHERE u.active = 1 GROUP BY u.id, u.email ORDER BY orders DESC LIMIT 10
BEGIN ... END blocks, loops) are formatted, but the indentation inside them is basic.Read the guide
Generate CREATE, INSERT, SELECT, UPDATE, and DELETE with correct quoting, then format the query so each clause is on its own line.
Standard SQL, MySQL, MariaDB, PostgreSQL, SQLite, SQL Server (T-SQL), Oracle PL/SQL, and Google BigQuery.
No. Only whitespace, line breaks, and the case of keywords change. Identifiers and string values are never changed.
It's a style choice; databases don't care. Uppercase keywords are the most common convention because they stand out from table and column names.
Often used together with SQL Formatter.
Syntax check of SQL statements per dialect, with the error position and expected tokens.
Removes comments and extra whitespace from SQL, keeping strings and optimizer hints intact.
Generates CREATE, INSERT, SELECT, UPDATE, and DELETE statements for four databases.