Clause Alignment
River-style right alignment: clause keywords are right-padded so content starts at the same column.
Basic SELECT/FROM/WHERE right-aligned
select a, b from t where x > 1
select a, b from t where x > 1
With GROUP BY and ORDER BY (longest keyword controls)
select a, count(*) from t where x > 1 group by a order by a
select a, count(*) from t where x > 1 group by a order by a
With JOIN
JOIN clauses are promoted to be siblings of FROM, at the same level as other top-level clauses.
select a from t1 inner join t2 on t1.id = t2.id where t1.x > 1
select a from t1 inner join t2 on t1.id = t2.id where t1.x > 1
Left alignment (default)
select a, b from t where x > 1
select a, b from t where x > 1
River style with HAVING
select a, count(*) from t where x > 1 group by a having count(*) > 5 order by a
select a, count(*) from t where x > 1 group by a having count(*) > 5 order by a