Schema - Do you create a consistent primary key column on your tables?

Updated by Brady Stroud [SSW] 1 year ago. See history

123
<introEmbed body={<> 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: Figure: Bad example

Employee.Id

✅ Figure: Figure: Good example

Why?

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

Acknowledgements

Adam Cogan
Related rules

Need help?

SSW Consulting has over 30 years of experience developing awesome software solutions.

We open source.Loving SSW Rules? Star us on GitHub. Star