3 ms·
>> Where possible avoid simply using "id" as the primary identifier for the table. > I wonder what is the reasoning behind this? To escape the ambiguity during
by Slackwise 8y ago
>> Where possible avoid simply using "id" as the primary identifier for the table.
> I wonder what is the reasoning behind this? To escape the ambiguity during joins?
Most justifications center around the "USING" clause which can only be used on matching column names:
select user_id,
username,
comment
from users
inner join
comments using (user_id);
Versus `on user.id = comments.user_id`.
The argument against this is that the USING clause really mucks up the result set columns by unifying those that match the USING clause.