In database management systems, a Candidate Key is a minimal super key—a set of one or more attributes that can uniquely identify every row in a table, with no unnecessary attributes included. Candidate keys are extremely important in relational database design because the primary key is selected from the set of candidate keys.

A candidate key guarantees uniqueness while also being minimal.


What is a Candidate Key?

A candidate key is a set of attributes that satisfies two conditions:

1. Uniqueness

The attribute set must uniquely identify every row in the table.

No two rows can have the same values for the candidate key.


2. Minimality

No attribute can be removed from the key without losing uniqueness.

This means the key contains no redundant attributes.

Because of this minimality condition:

  • every candidate key is a super key

  • but not every super key is a candidate key


Example of a Candidate Key

Consider the following STUDENT table:

Roll_NoEmailNameBranchCGPA
101aman@email.comAmanCSE8.5
102riya@email.comRiyaECE7.9
103kunal@email.comKunalME8.1

In this table:

  • Roll_No uniquely identifies each student

  • Email also uniquely identifies each student

So:

  • {Roll_No} is a candidate key

  • {Email} is also a candidate key


Super Key vs Candidate Key

Consider these attribute sets:

Candidate Keys

{Roll_No}
{Email}

These are candidate keys because:

  • they uniquely identify rows

  • they are minimal


Super Keys but NOT Candidate Keys

{Roll_No, Name}
{Email, Branch}

These are super keys because they still uniquely identify rows.

However, they are not candidate keys because:

  • extra attributes (Name, Branch) are unnecessary

  • removing them still preserves uniqueness

Therefore, they violate minimality.


Composite Candidate Key

Sometimes uniqueness depends on multiple attributes together.

Example: ENROLLMENT table

Roll_NoCourse_IDSemesterGrade
101C101Fall2024A
101C102Fall2024B
102C101Fall2024B

Here:

  • Roll_No alone is not unique

  • Course_ID alone is not unique

  • but {Roll_No, Course_ID} together are unique

So:

{Roll_No, Course_ID}

is a composite candidate key.


Properties of Candidate Keys

1. Unique

Every candidate key must uniquely identify tuples.


2. Minimal

No attribute can be removed without losing uniqueness.


3. Multiple Candidate Keys Allowed

A table may have several candidate keys.

One of them is later chosen as the primary key.


4. Can Be Single or Composite

Candidate keys may contain:

  • one attribute

  • or multiple attributes


Candidate Key vs Super Key

FeatureSuper KeyCandidate Key
Uniquely identifies rowsYesYes
MinimalNot requiredRequired
Can contain extra attributesYesNo
Used for primary key selectionNot alwaysYes

Every candidate key is a super key, but not every super key is a candidate key.


Candidate Key vs Primary Key

FeatureCandidate KeyPrimary Key
Number allowedMultipleOne
UniquenessRequiredRequired
NULL allowedNoNo
Selected as main identifierNot necessarilyYes

From all candidate keys, the database designer selects one as the primary key.

The remaining candidate keys become alternate keys.


SQL Example


Here:

  • Roll_No is a candidate key

  • Email is also a candidate key

If the designer chooses Roll_No as the primary key:

  • Email becomes an alternate key


Why Candidate Keys Matter?

Candidate keys are important because they:

  • help uniquely identify records

  • reduce redundancy

  • support normalization

  • help choose the best primary key

  • improve indexing and searching

  • maintain data integrity

They are fundamental to relational schema design.


Choosing a Good Candidate Key

A good candidate key should be:

  • unique

  • minimal

  • stable

  • non-null

  • short if possible

Examples:

  • Roll_No

  • Email

  • Aadhaar_No

  • Employee_ID


Common Real-World Examples

TablePossible Candidate Keys
STUDENTRoll_No, Email
EMPLOYEEEmployee_ID, Aadhaar_No
USERUsername, Email
VEHICLERegistration_No, VIN

Summary

A Candidate Key in DBMS is a minimal super key—a set of attributes that uniquely identifies every row in a table without containing unnecessary attributes. A table may have multiple candidate keys, and one of them is selected as the primary key. Candidate keys are essential in relational database design because they ensure uniqueness, support normalization, and form the basis for primary keys and alternate keys.