SQL formatter
Minified one-line SQL from ORM logs and copy-paste is hard to review. Pretty-print with keyword capitalization and nested indent for JOINs, CTEs, and subselects — before code review or documentation.
How to format SQL
1. Paste SQL query into editor.
2. Choose dialect hints if available (MySQL, PostgreSQL, Standard).
3. Click format.
4. Copy indented SQL for wiki or slide.
SQL formatting examples
Nested JOIN
SELECT with three LEFT JOINs indented per clause — spot missing ON condition faster.
CTE readability
WITH sales AS (...) main query separated visually from CTE block.
INSERT batch
Multi-row VALUES aligned column-wise for diff review.
When to format SQL
• When sharing queries in pull request comments.
• When learning SQL structure from generated ORM output.
• When documenting report queries for BI team.
Readable SQL in reviews
Reviewers catch missing WHERE tenant_id filter faster on indented SQL — security win beyond aesthetics.
Frequently asked questions
Which SQL dialect?
Generic formatters handle ANSI-ish SQL; MySQL backticks vs Postgres quotes differ.
Uppercase keywords?
Common style SELECT FROM WHERE — preference not requirement.
Validate syntax?
Formatting ≠ execution — run EXPLAIN in database for real validation.
Sensitive data?
Local format avoids SaaS leak — still redact PII in literals before sharing screen.
Minify SQL?
Remove newlines manually for embedded queries — opposite of format.