SQL Origins
- Created: IBM, early 1970s, as SEQUEL by Donald Chamberlin and Raymond Boyce
- Standardized: ANSI in 1986, ISO in 1987, revised many times since (SQL:2023 is the latest)
- Dialects: Every database extends the standard, so pick your dialect for the best results
Formatting Settings
- Dialect: Teaches the formatter dialect-specific syntax such as ::casts (PostgreSQL), [brackets] (SQL Server) or backticks (MySQL)
- Keyword case: UPPER keywords (SELECT, FROM) are the most common convention; preserve keeps your input as-is
- Indent style: Standard indents clauses; tabular styles align keywords in a column
- Expression width: Parenthesized expressions shorter than this stay on one line
- Logical operators: Put AND / OR at the start or the end of each line
Pro Tips
- Format generated ORM queries from logs to understand what actually hits the database
- Leading AND/OR makes it easy to comment out a single condition
- Format before committing migrations to keep git diffs readable
- If formatting fails, try a different dialect: vendor syntax may not parse as standard SQL