Re:SQL style guide
by dahdum on Sunday October 09, 2016 @02:20PM
(#12672511)
I disagree with this too, using table.id is easier to type and consistent when creating joins. It also encourages (forces) to reference the fields with tables prefix.
[ Parent
| on HN ]
One advantage of using user_id on both the pk of users as well as the fk side is you can do:
INNER JOIN comments USING (user_id)
instead of: INNER JOIN comments ON comments.user_id = user.user_id
Re:SQL style guide
by philliphaydon on Monday October 10, 2016 @07:29AM
(#12676403)
Which is fine if you are aware of the differences between the two. Since they act differently.
I don't think so, what differences are there? Could this be a database specific thing? In PG it seems equivalent.
Re:SQL style guide
by philliphaydon on Monday October 10, 2016 @09:06PM
(#12681198)
In MySQL you can end up with different results.