Key integrity
Relations are defined as a unique set of tuples where no two
tuples have the same combination of values for all their attributes. To be
distinct, they must have some primary key that allows to reference each tuple.
Key constraints deal with this issue.
- Candidate key:
- Each attribute or minimal combination of attributes that uniquely
identifies any tuple in a relation is called a candidate key. Minimal means
that removing an attribute leaves the key without the ability to uniquely
identify any tuple and therefore not being a candidate key anymore.
- Primary key:
- The primary key is one chosen key candidate that acts as the
identification key for a relation. Usually this is a short attribute like a
ID-number (identification key) or username. Attributes of the primary are
commonly underlined.