# Difference between Super key and Candidate key?

## Introduction:

In this article, we will explain the differences between the super key and candidate key in detail. Both keys are related to ensuring data uniqueness in a table and retrieving records from a table. They both contain NULL values. But there are many differences between them. Let's understand each key one by one and then we will understand their differences.

### What do you mean by Super Key?

A super key is a combination of either one or more columns that can uniquely identify each row in a table. No two rows in a super key can have identical values for the attributes that make up a super key. For example: In a student table ,Student_rollno, Student_Email makes super keys.

Following are the various key features or properties of a Super Key

• Each super key is not a candidate key.
• A super key can contain any combination of columns that guarantees row uniqueness.
• Every relation should have atleast one super key.
• All attributes of a relation taken together are a super key because each row in a relation is unique.

### What do you mean by Candidate Key?

It represents a set of attributes in a table which uniquely identifies every row of the table. The value of the candidate key must be unique for all rows in the table. A relation can have more than one candidate key. For example: In a student table Student_rollno makes a candidate key.

Following are the various key features or properties of a Candidate Key

• Candidate key attributes must ensure that no two rows have the same value in a table.
• Uniqueness of each attribute key in the candidate key is required to maintain the attribute.
• A relation must have atleast one candidate key.

Following are the tabular differences between super key and candidate key on the basis of comparison.

Basis Super Key Candidate Key
1. Unique A super key contains multiple columns where all columns must be selected to join the two tables. It uniquely identifies each row in a table so we can demonstrate it as a single identifier.
2. Count Super keys are more than in number as compared to candidate keys. Candidate keys are less in numbers.
3. Combination of keys The combinations of super keys become candidate keys. The combinations of candidate keys become the primary key.
4. Redundant A super key can contain redundant attributes. A candidate key cannot contain redundant attributes.
5. SQL Language It is a Data Manipulation Language It is Data Definition Language
6. Minimal It may or may not contain a minimal super key. It must contain a minimal key.
7. Irreducible It is a combination of a set of columns that uniquely identifies a row within a table but may or may contain irreducible property. The attributes which are used to form the keys should not be broken down into sub parts.

Next Topic#