Interview Q&A / SQL & DBMS

BeginnerQuick answer1 min readUpdated 3 Oct 2026

What is the difference between a super key, a candidate key and a primary key?

SHORT ANSWER

A super key is any set of columns that uniquely identifies a row. A candidate key is a minimal super key with no removable column. The primary key is the one candidate key you choose to identify rows.

Explain it simply

Think of identifying a student. Roll number alone works. Roll number plus name also works but the name is extra baggage. Email alone works too. All of those are super keys. The minimal ones, roll number and email, are candidate keys. The college picks roll number as the official one: that is the primary key.

Example

Table students(roll_no, email, name, city) where roll_no and email are each unique.

Key setSuper key?Candidate key?
{roll_no}YesYes
{email}YesYes
{roll_no, name}YesNo, name is removable
{name}No, names can repeatNo
  • Super keys here are every set containing roll_no or email.
  • Candidate keys are {roll_no} and {email}.
  • Primary key: choose {roll_no}.
  • The unchosen candidate {email} is called an alternate key, and is usually declared UNIQUE.

Every candidate key is a super key, but not the other way around.

What to say in the interview

"A super key uniquely identifies rows, a candidate key is a minimal super key, and the primary key is the chosen candidate. Remaining candidates are alternate keys, enforced with UNIQUE."

Common mistakes

  • Calling {roll_no, name} a candidate key, when it is only a super key.

#dbms#keys#candidate-key#super-key

Related questions

Practise more SQL & DBMS questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open SQL & DBMS quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.