3. Introduction
• Keys are very important part of relational data base.
• Keys are used to establish and identify relation between tables.
• Keys also ensure that each record within a table can be uniquely
identified by combination of one or more fields within a table.
4. DBMS have four different keys
These keys are all following
1. Primary key
2. Super key
3. Foreign key
4. Candidate key
5. Primary key
• A primary key is a column or set of columns in the table is called
primary key
6. Example:
• In this table the roll number or seat number is primary key
Roll number Name Department
BS-CS-36 Atif Computer science
BS-CS-19 Ali Computer science
BS-IT-15 Hussain Information technology
7. Super key
• A super key is a combination of columns is called super key
8. Example:
• In this table the roll number and name is a super key
Roll number Name Marks Department
BS-CS-36 Atif 85 Computer science
BS-CS-19 Ali 74 Computer science
BS-IT-15 Hussain 82 Information technology
10. Example:
• In this table two same name mention in foreign key
Roll number Roll number Name Marks Department
11. Candidate key
• A candidate key is a set of columns is called candidate key.
12. Example:
• In this table the roll number, name, marks are the candidate key
Roll number Name Marks Department
BS-CS-36 Atif 85 Computer science
BS-CS-19 Ali 74 Computer science
BS-IT-15 Hussain 82 Information technology