Home
Schema - Do you create a consistent primary key column on your tables?
  v6.0 Posted at 29/01/2020 4:13 PM by Christian Morford-Waite

​Make sure you created a consistent primary key column named Id on your tables.

Employee.ID, Employee.EmployeeId, Employee.EmployeeID, Employee.Employee_Code, Employee.Employee

Figure: Bad Example​​​

​ Employee.Id

Figure: Good Example

​​​Why?

  • ​We shouldn’t capitalise ID (identifier) as it is an abbreviation not an acronym.
  • ​Using the a​pproach [TableName]Id, e.g. EmployeeId, is redundant as we already know the context of the Id.​

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments: