Format SQL into something readable: consistent keyword casing, clause alignment, and indentation for nested subqueries and joins.
Format and beautify SQL queries with support for multiple dialects. Configurable keyword casing, indentation, and dialect-specific syntax. Supports Standard SQL, MySQL, PostgreSQL, T-SQL, PL/SQL, and BigQuery.
Formatted SQL will appear here...
Formatting is what makes a long query reviewable. A five-join query written as one line is unreadable to everyone including the person who wrote it, and the bugs that hide in it (a join condition on the wrong column, a WHERE clause that should be in the ON clause, a missing condition that silently produces a cross join) become visible the moment the clauses are aligned.
The specific thing to look for after formatting is the join conditions. A join with a condition that belongs in WHERE, or an outer join whose filter in WHERE quietly turns it into an inner join, are two of the most common SQL bugs and both are obvious in formatted output and invisible in a single line.