A query copied out of a log or an ORM arrives as one line 400 characters wide. Before you can debug it you have to see its shape: what is selected, which tables are joined, where the conditions are.
Paste it here. Each clause starts on its own line, selected columns are listed one per line, AND and OR conditions are indented under WHERE, and subqueries step in a level. Keywords can be capitalised or left lower case.
How to use the SQL Formatter tool
- Paste your SQL.
- Choose the indent and the keyword case.
- Copy the formatted query or download it.
Popular uses
- Reading a long query from an application log
- Tidying SQL before a code review
- Making queries in documentation consistent
Tips for the best result
- Strings and comments are never changed, so data inside quotes is safe.
- Several statements separated by semicolons are formatted one after another.
Quick facts
| Price | Free |
|---|---|
| Works with | SQL |
| Where it runs | In your browser, on your device |
| Account | Not needed |