3 ms·
> Joins should be indented to the other side of the river and grouped with a new line where necessary Don't agree here. Having all tables down the left makes i
by ScoutOrgo 8y ago
> Joins should be indented to the other side of the river and grouped with a new line where necessary
Don't agree here. Having all tables down the left makes it very easy to quickly scan all the tables that are being joined. With indents following the joined table, you can then quickly see and map in your head how all the tables are joining as well. This is how I would format the code in the Joins section:
SELECT r.last_name
FROM riders AS r
INNER JOIN bikes AS b
ON r.bike_vin_num = b.vin_num
AND b.engine_tally > 2
INNER JOIN crew AS c
ON r.crew_chief_last_name = c.last_name
AND c.chief = 'Y';
- jXCw1N0jtH3 8y agoYeah I like that. Personally I don't indent the join conditions either because of syntax highlighting, but at least yours is readable. The indentation in the "joins" and "subqueries" sections of the style guide are fucking atrocities. Who writes SQL like that?