SQL formatting and lint guides
Five articles: formatting rules, dialect differences, conditions that defeat an index, a DDL review, and dangerous write statements.
Format and dialects
FormatHow the SQL formatter lays out a statementClause-per-line layout, indentation and comma choices, and comments that survive.DialectsPostgreSQL, MySQL and SQLite differencesIdentifier quoting, auto-increment, casts, LIMIT and case sensitivity.
Indexes and DDL
Safe writes
DDLReviewing CREATE TABLE through a summaryTurn DDL into a table and find the gaps in keys and indexes.SafetyDangerous writes, NOT IN and N+1 queriesSpot statements that rewrite a whole table and lookups that repeat in a loop.
Once you have read the explanation, check it against the tool.
Open the tool