Naming convention for an identity column in a database

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?

Answers


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.


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.


Need Your Help

Springboot template files are not loaded

java templates spring-boot thymeleaf

I am writing my first springboot web app with project structure like below:

Python file does not run on Ubuntu on server but runs in local on Mac

python macos mongodb ubuntu azure

This is the code where I'm dumping all the data from .csv file into mongodb. What is strange is that it runs perfectly well on my mac but when I upload this code to Windows Azure running ubuntu 12....