Lecture-5-1
Lecture-5-1
Keys
By: Khalid Asad
Associate Professor
GSSC, Peshawar
Database Keys
• In a relational database, keys play an important role in
ensuring data integrity, maintaining relationships between
tables, and enforcing uniqueness.
• Understanding different types of database keys is crucial for
efficient database design, normalization, and query
performance.
2
Database Keys
3
Primary Key
4
Primary Key
5
Primary Key
6
Primary Key
7
Primary Key
8
Primary Key
9
Primary Key
10
Candidate Key
11
Candidate Key
12
Candidate Key
13
Alternate Key
14
Alternate Key
15
Super Key
16
Super Key
17
Super Key
18
Foreign Key (FK)
19
Foreign Key (FK)
20
Foreign Key (FK)
21
Composite Key
22
Composite Key
23
Unique Key
24
Unique Key
25
Secondary Key
26
Secondary Key
27
Secondary Key
28
Diff. b/w Primary & Secondary Key
29
Secondary Key
30
Surrogate Key
31
Surrogate Key
32
Surrogate Key
33
Summary Table of
Database Keys
34