Reputation: 6786
What is the point behind a naming convention when an identity column in a table is called like UserID
, ProductID
etc. instead of just an ID
? What are the prons and cons?
Upvotes: 3
Views: 1135
Reputation: 294287
The same point any code convention has primarily: consistency. While it can be argued both pro and against the Id
vs. EntityId
, there is no clear winner. I wouldn't say that this is one of those cases you need to pick a fight with... Is more important to stick to the rules of the org and keep the naming consistent.
Upvotes: 0
Reputation: 4519
One advantage of longer names: when you use columns in complicated query with many tables (e.g. joins) you don't have to prefix columns to know from what table they come from and also you minimize problems with column names ambiguity.
Upvotes: 4