Super Key
Super Key
Definition
A super key is any set of one or more attributes that, together, uniquely identify every tuple (row) in a relation. It is the loosest, most permissive notion of "uniqueness" in the relational model — every other kind of key in this chapter is a specific, more disciplined kind of super key.
How It Works
Running example used throughout this chapter — a students(id, name, email, department_id) table:
| id | name | department_id | |
|---|---|---|---|
| 1 | Asha | asha@co.com | 1 |
| 2 | Rohan | rohan@co.com | 1 |
| 3 | Neha | neha@co.com | 2 |
For the students table, all of the following are valid super keys:
{id}— uniquely identifies every row.{email}— also uniquely identifies every row (assuming emails are distinct).{id, name}— still uniquely identifies every row (adding an extra column to an already-unique set can never break uniqueness).{id, name, email, department_id}— the entire row, trivially a super key (a full row is always unique unless the table allows exact duplicate rows).
Note that {id, name} is a super key but it is not minimal — name is redundant, since {id} alone already does the job. This is exactly the property that separates a super key from a candidate key (5.2): a candidate key is a super key with no redundant attribute.
Edge Cases and Pitfalls
- Every relation has at least one super key — in the worst case, the set of all its attributes always qualifies (assuming no fully duplicate rows are allowed, which the relational model assumes by definition of a "set" of tuples).
- Adding ANY attribute to an existing super key always produces another, larger super key — this is why super keys are not unique by themselves; a table can have unboundedly many of them once you start combining.
- Confusing "a super key" with "the key" is a common beginner error — in casual conversation people usually mean primary key when they say "key," but formally, super key is the broadest category that primary key, candidate key, etc. all live inside.
Key Takeaways
- A super key uniquely identifies rows, but may contain unnecessary extra attributes.
- Every candidate key, primary key, and alternate key is ALSO a super key — the reverse is not true.
- Super key is the umbrella concept; the rest of this chapter narrows it down.