Schema - Do you create primary key on your tables?

Last updated by Babanazar Kamyljanov [SSW] 6 months ago.See history

When you specify a PRIMARY KEY constraint for a table, SQL Server enforces data uniqueness by creating a unique index for the primary key columns. This index also permits fast access to data when the primary key is used in queries. Although, strictly speaking, the primary key is not essential - we recommend all tables have a primary key (except tables that have a high volume of continuous transactions).

sql table without primary key
Figure: Bad Example - Table missing primarykey

sql table with primary key
Figure: Good Example - Table with primary key

Legacy:

Especially, when you have a client like Access, it would help you to avoid the problems.


Adam Cogan
We open source.Loving SSW Rules? Star us on GitHub. Star
Stand by... we're migrating this site to TinaCMS