🦸 Super Key
🟢 Beginner
📖 Definition
A Super Key is any set of one or more columns that uniquely identifies a row in a database table. A Super Key may contain extra/redundant columns that are not strictly necessary for unique identification. A Candidate Key is simply a minimal Super Key (a Super Key with zero redundant columns).
🌍 Multilingual Explanations
English
A Super Key is any attribute set that uniquely identifies table tuples. Adding additional columns to a Candidate Key forms a Super Key.
Hindi
Super Key me ek ya adhik columns ka combination hota hai jo row ko unique banata hai. Isme extra attributes bhi ho sakte hain.
Marathi
Super Key mhanje record la unique banana-re columns cha group. Yatch extra redundant columns asu shaktat.
Hinglish
Super Key is the superset — if `emp_id` is unique, then `(emp_id)`, `(emp_id, name)`, and `(emp_id, email)` are all valid Super Keys!
📊 Relationship Matrix: Super Key vs. Candidate Key
┌─────────────────────────────────────────┐
│ SUPER KEYS │
│ (e.g. {id}, {id, name}, {id, age}) │
│ │
│ ┌───────────────────────────────┐ │
│ │ CANDIDATE KEYS │ │
│ │ (Minimal Super Keys) │ │
│ │ (e.g. {id}, {email}) │ │
│ │ │ │
│ │ ┌─────────────────────┐ │ │
│ │ │ PRIMARY KEY │ │ │
│ │ │ (Chosen Key) │ │ │
│ │ └─────────────────────┘ │ │
│ └───────────────────────────────┘ │
└─────────────────────────────────────────┘
💡 Tabular Example
Consider a table students(student_id, email, full_name, age) where student_id and email are unique:
| Column Combination | Is Unique? | Is Super Key? | Is Candidate Key? | Reason |
|---|---|---|---|---|
{student_id} |
Yes | Yes | Yes | Minimal & Unique |
{email} |
Yes | Yes | Yes | Minimal & Unique |
{student_id, full_name} |
Yes | Yes | No | Contains redundant column (full_name) |
{student_id, age} |
Yes | Yes | No | Contains redundant column (age) |
{full_name, age} |
No | No | No | Two students can share name and age |
⚠️ Common Pitfalls & Mistakes
- Assuming every Super Key is a Candidate Key: Adding extra columns to a Primary Key still leaves it as a valid Super Key, but it ceases to be a Candidate Key.
- Over-indexing Super Keys: Creating indexes on redundant Super Keys (like `PRIMARY KEY (id, name)`) wastes database disk storage and slows down write operations.
🎯 Tiered Practice Exercises
- Beginner: List 3 different Super Keys for a table with columns
roll_no(unique),name, andphone. - Intermediate: Given candidate keys
{ssn}and{emp_id}, list all possible 2-column Super Keys. - Advanced: Prove mathematically why the total number of Super Keys is always greater than or equal to the number of Candidate Keys.
🧭 Navigation
← Previous: Candidate Key | Keys Overview | Next: Alternate Key →