WebTools

Format SQL

Long one-line queries, laid out and readable.

Lay out a SQL query written on one line: keywords upper-cased, each field on its own line and the JOINs aligned. It reads instead of having to be deciphered.

It understands the MySQL, PostgreSQL, SQLite, MariaDB and BigQuery dialects, which is what stops it mangling the syntax specific to each.

How to use it

  1. Paste the query.
  2. Choose the dialect.
  3. Copy the result.

Frequently asked questions

Does it change what the query does?
No. It only touches whitespace, line breaks and keyword case; table and column names are left exactly as you wrote them.
Why does it say it cannot parse it?
Because there is syntax the chosen dialect does not recognise. Try your engine’s specific dialect before “standard SQL”.
Can I format several at once?
Yes, separated by semicolons. They come out separated by a blank line.

Related tools