databases

Definition

Key Candidate

In a table, a key candidate is a potential primary key due to its uniqueness. However, it must not fulfil all primary key criteria, only unique must be fulfilled.


Examples

Email as Key Candidate

An email is a potential primary key, since it is unique across all users in the table, but according to the primary key criteria, a primary key should be |immutable (stable), meaning that it is not opposed to any reason for change. Users, however, quite frequently want to change their emails for the user accounts.

Therefore, email is a key candidate due to its uniqueness, but it is mutable, why is the reason why it should not be chosen for the primary key.

Social Security Number as Key Candidate

The social security number is a potential primary key, since it is unique across all users in the table, but according to the primary key criteria, a primary key should be not-null. The social security number, however, might be null for users from other countries or states.

Therefore, the social security number is a key candidate due to its uniqueness, but it is nullable, why is the reason why it should bot be chosen for the primary key.