Candidate Key
A set of one or more Attributes that can be considered for use as a Primary Key and therefore means each Tuple in a Relation is unique. Unlike Super Keys all Attributes in a Candidate Key must be required to create uniqueness. It is normal for there to be more than one Candidate key. From a list of Candidate Keys one is chosen to be the Primary Key and the rest are considered Alternate Keys.
Example:
| UserId | UserName | Password | |
|---|---|---|---|
| 1 | AJones | alex.jones@abc.com | ######## |
| 2 | BSmith | bob.smith@def.com | ######## |
| 3 | CBloggs | chris.bloggs@xyz.com | ######## |
For the table above the list of possible Candidate Keys are:
- (UserId, UserName, Email)
- (UserId, UserName)
- (UserId, Email)
- (UserId)
- (UserName)
- (Email)
In the table above UserId would be chosen as the Primary Key and the rest would be considered Alternate Keys.