How to use the SQL formatter
Paste a query and it is laid out straight away.
- Paste one or more statements into the Input box, or press Paste. Try it loads a short query. Statements separated by semicolons are formatted one after another, with a blank line between them.
- Pick the Keyword case: UPPER writes keywords such as SELECT and FROM in capitals, lower writes them in lowercase, and Keep leaves them as you typed them.
- Choose the Indent: 2 spaces, 4 spaces or Tab. It controls how far AND, OR and subqueries are pushed in.
- Read the status line, which reports how many tokens were formatted.
- Press Copy or Download .txt, then rename the download to .sql. Use as input moves the result back into the input box.
Quoted text, comments and numbers are never altered, and the query stays in your browser. That is useful when it contains customer identifiers or production table names.