A Primary Key creates a unique ID for each record in a table.
When to use
You should always designate a primary key for your tables.
To create a new table with a Primary Key that auto generates every time a new record is added:
CREATE TABLE Persons (
ID int IDENTITY(1,1) PRIMARY KEY,
Hints & tips
- Primary Keys create a unique ID for each record in a table.
- Always use Primary Keys!
Lesson notes are only available for subscribers.