Computer Science · Ch 8 — Database Concepts
Candidate Key
Candidate Key
A candidate key is an attribute (or a set of attributes) that can uniquely identify every row (tuple) in a relation. The name comes from the fact that each candidate key is a candidate for being chosen as the primary key of the table.
A relation may have more than one attribute that always takes distinct values for every record. Any such attribute qualifies as a candidate key because it can serve the purpose of unique identification.
Consider the GUARDIAN relation shown in Figure 8.4 of the textbook. It has four attributes. Out of these, two attributes — GUID and GPhone — always hold unique values. No two guardians will ever share the same phone number, and no two guardians will ever share the same GUID. Therefore, both GUID and GPhone are candidate keys for the GUARDIAN relation. Each is a valid candidate for being selected as the primary key.
A candidate key must satisfy two properties:
- Uniqueness: No two tuples can have the same value for the candidate key.
- Irreducibility (minimality): No proper subset of the candidate key can uniquely identify tuples. (For a single-attribute candidate key, this is automatically true.) …