Difference Between Super Key and Candidate Key

By Anjnee Bhatnagar|Updated : October 14th, 2022

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 focussed 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.

Download Formulas for GATE Computer Science Engineering - Algorithms

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.

Download Formulas for GATE Computer Science Engineering - Databases

Other Important GATE Topics
Difference Between Linear and Non-Linear Data StructuresDifference between Microprocessor and Microcontroller
Difference Between Hard Copy and Soft CopyDifference Between overloading and overriding
Difference Between High-Level and Low-Level LanguagesDifference Between drop and truncate

Comments

write a comment

FAQs on 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, unlike a super key, which is a set of attributes or columns that uniquely identifies each row table.

  • A candidate key identifies a tuple uniquely in the relation. For example, the candidate key for a relation Employee with attributes Emp_id, Emp_name, Emp_dep can be Emp_id as it can alone uniquely identify a tuple in the relation.

  • A super key is the superset of the candidate key. A super key determines a tuple uniquely in the relation. Every candidate key can be a super key for the relation, but vice versa is not true. This adds to the difference between super key and candidate key.

  • A candidate key uniquely determines a tuple in the relation. A primary key is selected from one of the candidate keys which do not contain null values. The candidate key, which has only unique attribute values, is selected to be the primary key for the relation.

  • The difference between super key and candidate key in terms of numbers is that there can be more super keys for a relation than the candidate keys. As the super keys can be found using the candidate key of the relation.

Follow us for latest updates