Difference Between Super Key and Candidate Key

By BYJU'S Exam Prep

Updated on: September 25th, 2023

Keys play an essential role in RDBMS. A key helps in identifying a tuple in the relation. In a relational database, we have different types of keys: primary key, candidate key, super key, and foreign key. Here, we have focused on the difference between the super key and the candidate key.

Difference Between Super Key and Candidate Key PDF

The difference between a super key and a candidate key is that the candidate key is a subset of the super key. Let us check the brief introduction about super keys, candidate keys, and the difference between super key and candidate keys given in the upcoming sections.

Download Formulas for GATE Computer Science Engineering – Programming & Data Structures

Table of content

Difference Between Super Key and Candidate Key

The difference between super key and candidate key is that a candidate key is a set of attributes that recognizes the tuples in relation or table, while a super key is a set of attributes or columns that uniquely identifies each row table. The difference between super key and candidate key are listed in the table below.

 Super Key VS Candidate Key Super Key Candidate Key The set of attributes that uniquely identify a tuple in the relation. The minimal set of attributes that identify a tuple uniquely in the relation. The number of super keys can be more than the candidate keys for a relation. The number of candidate keys is less than the super keys for a relation. Every super key cannot be a candidate key. Every candidate key is a super key. Null values can be taken by the attribute of a super key. Null values are allowed for a candidate key.

What is a Super Key?

A super key is the set of attributes that uniquely identify a tuple in the relation. A super key can find out using the candidate keys of the relation. This is the subtle difference between super key and candidate key. A super key is a superset of the candidate key.

Using the inclusion-exclusion principle formula, we can find the number of super keys for a relation with two or more candidate keys.

What is a Candidate Key?

A candidate key is defined as the minimal set of attributes that uniquely identify a tuple in the relation. There can be many candidate keys for a relationship. Some of the characteristics of the candidate keys are:

• A candidate key may allow null values.
• The primary key is chosen from one of the candidate keys.
• There can be many candidate keys for a relationship.
• The candidate key helps in finding the number of super keys.