CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
Concept of Keys in DBMS.pptx
1. “Concept of Keys in Data Base Management System (DBMS)”
Presented By
Deependra Kumar Shukla
For the Post of Assistant Professor in the Department of Computer Science
Pandit S. N. Shukla University, Shahdol, Madhya Pradesh-484001
Educational qualification:
• Ph.D. (CS) (Persuing).
• M.Tech. (CS).
• B.E. (IT).
• GATE-2017 with AIR-1972
• UGC - NET and JRF- December-2018
Concept of Keys in Data Base Management System (DBMS)
2. Table of Contents
Concept of Keys in Data Base Management System (DBMS)
• Super key or Key
• Candidate key
• Primary key
• Alternate key
• Composite key
• Foreign key
• Q&A
3. Super Key
Concept of Keys in Data Base Management System (DBMS)
Definition: A non-empty set of attributes of a relation (table) is said to be Super key if it is able to
uniquely identify all the Record or Tuple of that table.
(एक या एक से अधिक ऐधरि ब्यूर्स का समूह जो डाराबेस रेबल क
े प्रत्येक Record को अलग – अलग
पहचानने में सक्षम हो उसे Super key कहते है|)
For example: Table1
Values of a Super key
is always unique but it
may be “NULL” also.
Super keys of table1 are: {(Sid), (Sid, Name), (Sid, Course), (Sid, Name, Course)}
Sid Name Course
1 Manish BCA
2 Manish MCA
3 Raghav BCA
4 Ritik MCA
5 Nidhi BE
6 Ritik MCA
4. Super Key
Concept of Keys in Data Base Management System (DBMS)
Another examples are: Table2
Super keys of table 2 are: {(A,B)}.
Table3
Super key of table3 are : {(C),(A,B),(A,C),(B,C), (A,B,C)}
A B
1 2
2 8
1 3
4 2
5 3
A B C
1 2 1
2 8 2
1 3 3
4 2 4
5 3 5
5. Candidate Key
Concept of Keys in Data Base Management System (DBMS)
Definition: A minimal super key is known as Candidate key.
Or
A super key is said to be candidate key if its proper subset is not a key itself.
(ऐसी super-key धजसका कोई भी प्रॉपर सबसेर अपने-आप में key ना हो उसे Candidate-key कहते हैं|)
For example:
Super keys of the table1 are: {(Sid), (Sid, Name),(Sid, Course),(Sid, Name, Course)} then
• Here, Sid is a candidate-key because its proper subset is not a key.
• (Sid, Name),(Sid, Course),(Sid, Name, Course) are not the candidate key because all of
these has a proper subset Sid which is a key itself.
Note: Candidate key satisfy “unique” constraint but not “NULL” constraint.
6. Candidate Key
Concept of Keys in Data Base Management System (DBMS)
Another examples are:
Super keys of table 2 is: {(A,B)}
• Here proper subset A and B is not a key in itself, therefore AB is a candidate key.
Super key of table3 are : {(C),(A,B),(A,C),(B,C), (A,B,C)}
• C is a candidate key because its proper-subset is not a key.
• (A,B) is a candidate key because its proper subset A and B is not a key.
• (A,C),(B,C), (A,B,C) are not the candidate key because C is one of the proper subset of all
these keys and C itself is a key.
7. Primary Key
Concept of Keys in Data Base Management System (DBMS)
Definition: A Candidate key with no null values is said to be primary key. Every relation
(Table) must have a primary key.
(ऐसी Candidate-key धजसमे “Null” values नहीीं होती उसे Primary-key कहते हैं| प्रत्येक डाराबेस रेबल
में एक Primary key अधनवायय होती है|)
For example:
• Candidate key of the table1 is Sid. If we apply here not null constraints then it become the
Primary key.
• Candidate key of table 2 is {(A,B)}. If we apply here not null constraints then it becomes the
Primary key.
• Candidate key of table3 are : {(C), (A,B)} Here, either (C) or (AB) can be made as primary key
with not null constraints. Because in a database table only one primary key is possible.
Note: Primary key satisfy both “unique” and “NULL” constraint.
8. Alternate Key & Composite Key
Concept of Keys in Data Base Management System (DBMS)
Definition: Those Candidate keys which are not primary key are called as Alternate keys.
(ऐसी Candidate-key जो Primary-key नहीीं होती उन्हें Alternate-keys कहते हैं|)
For example:
• Candidate key of table3 are : {(C), (A,B)}Here, if we make C as primary key then (A,B)
becomes the alternate key and vice-versa.
• In table1 and table2 there will be no alternate key because only one candidate key is there.
Note: Alternate key satisfy “unique” constraint but not “NULL” constraint.
Composite Key: If a key contains more than one attribute then it is called as composite key.
For example:
• Key (A,B) contains two attributes A and B therefore it is called as Composite key.
9. Foreign Key
Concept of Keys in Data Base Management System (DBMS)
Definition: A FOREIGN KEY is a field (or collection of fields) in one table, that refers to the
PRIMARY KEY in another table. The table with the foreign key is called the child table, and
the table with the primary key is called the referenced or parent table.
(Child table का वह attribute जो पैरेंर रेबल की Primary key को refer करता है foreign key कहलाता
है|)
For example: Let us examine the following student and Department table.
Note: Foreign key does not satisfy both “unique” and “NULL” constraint.
10. Summary
Concept of Keys in Data Base Management System (DBMS)
Set of Super Keys
Super key follows only “Unique” constraints but not “Not Null”
Set of Candidate Key
Candidate key follows only “Unique” constraints but not “Not Null”
Set of Alternate Key
Alternate key follows only “Unique” constraints but not “Not Null”
Primary Key
It follows both “Unique” and “Not null” constraints
If a Key has more than one
attributes ten it is called composite
key
Foreign key is used for
referential integrity.
11. Thank you for your attention
Concept of Keys in Data Base Management System (DBMS)
Q & A...
Thank you.