What SQL pretty print gives you
The query is formatted first, with the same options as the SQL formatter. The result is then shown in a reading view with line numbers and syntax colors. The plain text of the result is what you copy, with no numbers and no markup.
What the colors mean
| Color | Meaning |
|---|---|
| Purple | Keywords and data types, such as SELECT, JOIN, WHERE, INT and VARCHAR |
| Gold | Function calls, such as COUNT(), COALESCE() and NOW() |
| Blue | Strings in single quotes |
| Orange | Numbers |
| Grey italic | Comments |
Why colors help
- A missing closing quote turns the rest of the query into one blue string, so you see it at once.
- A missing closing comment mark makes the rest of the query grey.
- A keyword used as a column name, such as a column called order or group, shows up in the keyword color.
- A number that should be a string, such as a zip code without quotes, is easy to spot in the number color.
Line numbers
Line numbers help you talk about a query in a code review, a bug report or a chat: "the problem is on line 14". They also match the line numbers in error messages from some database tools, when you paste a query that has the same layout.
Options
Choose the dialect, indent, keyword case, comma position, and whether AND / OR and CASE use several lines. All of the options of the formatter work here.
See also the SQL beautifier, the SQL minifier and the SQL formatting guide. Other pretty print tools: HTML pretty print, CSS pretty print and JavaScript pretty print.