notes/School/Development/Primary Key.md

584 B

Primary Key

A Primary key is a Constraint that uniquely identifies SQL Database#Entity in a entity set (table). Only one pair of values that the primary key forms can exist within a entity set (table).

There can only be ONE primary per table and can consist of multiple attributes (columns).

A primary key is not required, but highly advised. Even if you don't use it its better to include one in your schema.

Example

Name (PK) - Age - Sex - Length

In the table schema above, only one entity where the name is Nick can exist because Name is the primary key.