Vertical rivers - cobol style
When writing SQL I don't think procedurally, which means I don't think about nested, indented "blocks" unless I'm actually using some procedural style SQL extensions like try/catch, if, case (which is a little procedural expression inside a set based statement), and so on.
Because of this, I like to align various different "types of things" in a statement to create vertical rivers.
So, for example, insert, update, select, from, join, where, group by, having, and order by are all aligned on the left. You might think of this as "column 1 - sql keywords".
Then come column names, table names (inside from/join), and expressions (inside where, having, order by). All of this is "column 2". My formatting for insert target columns is hard to justify, but it's basically the table name is left aligned to column 2, with the target columns indented.
Table aliases are "column 3".
Join conditions ("on" and "and") are column 4. Complex joins which turn into "producural-like" if nestings are hard to set a rule for.
This results in a style with "vertical rivers" through the code. It's easy to scan down quickly and see which columns are used, which tables are used, what the aliases are, etc.
If a statement is nested (eg, a subquery), then the subquery gets its own "column 1, column 2", and so on.
I believe Jeff Moden uses a similar style. The result looks like this:
I don't know how many others work this way, but I thought I'd throw it out there. It's currently not possible to set this up with SQL prompt.