Types of Keys
Primary Key:
The values in the column should Uniquely define the Record/Tuple in that Table.
ID
|
STUDENT_NAME
|
CLASS
|
MARKS
|
PHONE
|
eg.
Consider that the Reference Table is:
Supplier_ID
|
Name
|
Phone
|
1
|
ABC
|
7846
|
2
|
DEF
|
7585
|
3
|
GHI
|
7886
|
Item_id
|
Item_name
|
Supplier
|
45
|
pencil
|
1
|
76
|
eraser
|
1
|
89
|
scale
|
2
|
eg.Consider the following table where the Primary key is Reg_no. and exam_seat_no.
Reg_no
|
Student_name
|
class
|
Exam_seat_no
|
DOB
|
Now, the Reg_no , Student_name and Eaxm_seat_no can uniquely define a student.
Similarly, Reg_no and Exam_seat_no can uniquely define a student but it's not minimal .
Only Reg_no or Exam_seat_No can Uniquely define a student hence Reg_no and Exam_seat_no separately are Candidate keys.
Super Keys:
In above example, Reg_no and Student_name together or Reg_no and Exam_seat_no together or all the three together are called Super key.
So, Super Key is basically the group of columns which can Uniquely define a Record/Tuple ,and not necessarily be minimal.
Note:
EVERY CANDIDATE KEY IS A SUPER KEY BUT A SUPER KEY MAY BE / MAY NOT BE A CANDIDATE KEY.
No comments:
Post a Comment