3 ms·
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 p
by dahdum 10y ago
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.
- ryeguy 10y agoOne 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
- philliphaydon 10y agoWhich is fine if you are aware of the differences between the two. Since they act differently.
- ryeguy 10y agoI don't think so, what differences are there? Could this be a database specific thing? In PG it seems equivalent.
- philliphaydon 10y agoIn MySQL you can end up with different results.