Hacker News new | ask | show | jobs
by dchess 2327 days ago
I don't see the benefit of putting table names on a different line than the keyword.

How is this:

  FROM
    tablename t
  INNER JOIN
    other_table ot
  ON
    t.id = ot.id
More readable than:

  FROM tablename t
  INNER JOIN other_table ot
    ON t.id = ot.id
I agree with a lot of these recommendations, but this one irks me. Also I'd love if someone could create a nice code-formatter for SQL like Python's Black.
1 comments

In the join case, it makes your diffs nicer when joining multiple tables

    FROM foo
    INNER JOIN
        other_table using (other_table_id)
to:

    FROM foo
    INNER JOIN
    +  foo_bars using (foo_id),
       other_table using (other_table_id)