GUIDE深度 · Deep dive
Formatting SQL for Readability
Readable SQL usually puts each major clause on its own line, one SELECT item per line, JOIN conditions next to the JOIN, and uses consistent keyword case. Consistency matters more than a perfect style.
Suggested layout
SELECT on one line, each column on its own.
FROM/JOIN/WHERE/GROUP BY/ORDER BY each on a line.
Indent AND/OR under the condition.
Aliases
Use short, consistent table aliases (u/o/i).
Use AS for column aliases to avoid keyword collisions.
FAQ
Must keywords be uppercase?
No, but pick one style for the team.
Can auto-formatting change semantics?
Proper tools should not; still review the diff.