You are on page 1of 21

WELCOM

E
KEYS IN
DBMS
TEAM MEMBERS:
1. Sushree Srabani Sahoo(220301120216)
2. Pritichhanda Rout(220301120214)
3. Dibyajyoti Samantaray(220301120229)
4. Seikh Irfan Ussman(220301120219)
5. Debi Prasad Dash(220301120203)
E
K Y S
1
PRIMAR
Y KEY
1 2
PRIMAR CANDIDA
Y KEY TE KEY
1 2 3
PRIMAR CANDIDA SUPER
Y KEY TE KEY KEY
1 2 3 4
PRIMAR CANDIDA SUPER FOREIG
Y KEY TE KEY KEY N
KEY
PRIMAR CANDIDA SUPER FOREIG
Y KEY TE KEY KEY N
KEY
1 PRIMARY KEY

1.There can be many columns in relation out of which one can be chosen as the primary key .
For Example: S_RollNo as well as S_PhoneNo , are candidate keys for relation STUDENT but
S_RollNo can be chosen as the Primary Key .
 It is a Unique Key .
 It Can identify only one tuple at a time.
 It has no duplicate values , it has unique values .
 It can not be NULL .
EXAMPLE:
STUDENT table  STUDENT (S_RollNo,S_Name,Address,S_PhoneNo) ,
Here S_RollNo is a primary key .
Table STUDENT 

S_RollNo S_Name Address S_PhoneNo

220301120216 Sushree Srabani Jagatsinghpur 7205770053

220301120214 Pritichhanda Rout Jagatsinghpur 7504875462


Dibyajyoti
220301120229 Cuttack 8093857516
Samantaray
220301120219 Sheikh Irfan Usman Bhubaneswar 1234567890

220301120203 Debi prasad Dash Puri Null

 Here S_RollNo and S_PhoneNo column has unique value but S_RollNo is consider as Primary Key.
PRIMAR CANDIDA SUPER FOREIG
Y KEY TE KEY KEY N
KEY
2 CANDIDATE KEY

 The minimal set of attributes that can uniquely identify a tuple is known as a candidate key. For Example,
S_RollNo in STUDENT relation. 
 It is a minimal super key.
 It is a super key with no repeated data is called a candidate key.
 It must contain unique values.
 It can contain NULL values.
 Every table must have at least a single candidate key.
 A table can have multiple candidate keys but only one primary key (the primary key cannot have a NULL
value, so the candidate key with a NULL value can’t be the primary key).
 The value of the Candidate Key is unique and may be null for a tuple.
 There can be more than one candidate key in a relationship. 
Table STUDENT 

S_RollNo S_Name Address S_PhoneNo

220301120216 Sushree Srabani Jagatsinghpur 7205770053

220301120214 Pritichhanda Rout Jagatsinghpur 7504875462


Dibyajyoti
220301120229 Cuttack 8093857516
Samantaray
220301120219 Sheikh Irfan Usman Bhubaneswar NULL

220301120203 Debi Prasad Dash Puri NULL

 Here S_RollNo and S_PhoneNo column has unique and null value and consider as CANDIDATE
key .
PRIMAR CANDIDA SUPER FOREIG
Y KEY TE KEY KEY N
KEY
3 SUPER KEY

 The set of attributes that can uniquely identify a tuple is known as Super Key. For Example, STUD_NO,
(STUD_NO, STUD_NAME), etc. A super key is a group of single or multiple keys that identifies rows in a
table. It supports NULL values. 
 Adding zero or more attributes to the candidate key generates the super key.
 A candidate key is a super key but vice versa is not true.
Table STUDENT 

S_RollNo S_Name Address S_PhoneNo Gmail

220301120216 Sushree Srabani Jagatsinghpur 7205770053 216@cutm.ac.in

220301120214 Pritichhanda Rout Jagatsinghpur 7504875462 214@cutm.ac.in

220301120229 Dibyajyoti Cuttack 8093857516


Samantaray 229@cutm.ac.in

220301120219 Sheikh Irfan Usman Bhubaneswar NULL 219@cutm.ac.in

220301120203 Debi Prasad Dash Puri NULL 203@cutm.ac.in

 Here S_RollNo ,S_PhoneNo and Gmail columns are SUPER KEY .


PRIMAR CANDIDA SUPER FOREIG
Y KEY TE KEY KEY N
KEY
4 FOREIGN KEY

 If an attribute can only take the values which are present as values of some other attribute,
it will be a foreign key to the attribute to which it refers. The relation which is being
referenced is called referenced relation and the corresponding attribute is called
referenced attribute the relation which refers to the referenced relation is called
referencing relation and the corresponding attribute is called referencing attribute. The
referenced attribute of the referenced relation should be the primary key to it.
 It is a key it acts as a primary key in one table and it acts as secondary key in another
table.
 It combines two or more relations (tables) at a time.
 They act as a cross-reference between the tables.
Table STUDENT  Table STUDENT_MARK 

S_RollNo S_Name BRANCH S_RollNo MARK

220301120216 Sushree Srabani CSE 220301120216 522

220301120214 Pritichhanda Rout ECE 220301120214 520

Dibyajyoti
220301120229 ECE 220301120229 510
Samantaray
Sheikh Irfan
220301120219 CSE 220301120219 506
Usman

220301120203 Debi Prasad Dash CSE 220301120203 500

 HERE S_RollNo in STUDENT is a foreign key to S_RollNo In


STUDENT_MARK relation.
PRIMAR CANDIDA SUPER FOREIG
Y KEY TE KEY KEY N
KEY

You might also like