Primary Key
- Always Unique
- Never NULL
- Only one per table
- Required per table
Candidate Key
- Uniquely identify a row
- Non-key attributes
- The primary key is chosen from these
Super Key
- A set of attributes that uniquely identify a row but is not minimal
- StudentID → superkey
- (StudentID, Name) → still a superkey
- (StudentID, Email, Age, Height) → still a superkey = with Student Id considered as unique
Natural Key
- A key that already exists in the real world
Surrogate Key
- A system-generated key with no real-world meaning
- A made-up ID just for the database
Intelligent Key
- A key that encodes meaning inside it
- EMP2024‑001 (year + type + sequence)
- PH‑MNL‑0001 (country + city + sequence)
Alternative Key
- A candidate key that was NOT chosen as the primary key
- Unique and Valid
🧩 Summary Table
| Key Type | Meaning | Shortcut Memory | Example |
|---|---|---|---|
| Primary Key | The officially chosen unique identifier of the table. | The chosen one | UserID |
| Candidate Key | Any attribute (or combo) that can uniquely identify a row. | All possible unique identifiers | Email, Username |
| Super Key | Any attribute set that uniquely identifies a row (even with extras). | Unique with extra baggage | (UserID, Email) |
| Natural Key | A key that comes from real-world data. | Already exists in real world | PlateNumber, SSN |
| Surrogate Key | A system-generated key with no real-world meaning. | Made-up ID for the database | Auto-increment ID, UUID |
| Intelligent Key | A key that encodes meaning inside it. | ID with built-in meaning | EMP-MNL-2024-001 |
| Composite/Compound Key | A key made of two or more columns acting together as one identifier. | Multiple columns = one key | (StudentID, CourseID) |
| Alternative Key | A candidate key not chosen as the primary key. | The runner-up | Email if UserID is PK |