Types of Keys in DBMS
Types of Keys in DBMS
There are mainly Eight different types of Keys in DBMS and each key has it’s
different functionality:
1. Super Key
2. Primary Key
3. Candidate Key
4. Alternate Key
5. Foreign Key
6. Compound Key
7. Composite Key
8. Surrogate Key
Example:
Example:
In this table, StudID, Roll No, Email are qualified to become a primary key. But
since StudID is the primary key, Roll No, Email becomes the alternative key.
Candidate key Example: In the given table Stud ID, Roll No, and email are
candidate keys which help us to uniquely identify the student record in the table.
Candidate Key in
DBMS
DeptCode DeptName
001 Science
002 English
005 Computer
Teacher ID Fname Lname
In this table, adding the foreign key in Deptcode to the Teacher name, we can
create a relationship between the two tables.