APM Welcome, APM North West Network Conference, Synergies Across Sectors
Keys in DBMS.pptx
1. KEYS IN DBMS
• Definition: A key is an attribute or set of attributes that uniquely identifies any
record or tuple from the table .
• Purpose :
• Key is used to uniquely identify any record or row of data from the table .
• It is also used to establish and identify relationships between tables .
2. 1.SUPER KEY
• A super key is a combination of attributes or set of attributes that can uniquely identifies the
Each record of the relation.
• Example for super key .
R(A,B,C,D)
1 1 5 1 SK=`{A}, {AB} , {AC} , {AD}, {ABC} ,{ACD},
2 1 7 1 {ABD}, {ABCD},
3 1 7 1
4 2 7 1
5 2 5 1
3. CANDIDATE KEY
• It is super key Whose proper subset is not a super key.
• It is minimal super key
what is a subset?
S1={1,2,3}
S2={1,2}
Here s2 contains all elements of s1 hence S2⊆ 𝐒𝟏.
What is proper subset?
S2⊂S1 These two conditions must be satisfied
1.S2 ⊂S1
2.S1⊈ S2
4. EXAMPLE:
R(A,B,C)
1 1 1 Super key = A, AB, AC, ABC, BC
2 1 2
3 2 1 Proper Subset of ABC=AB, BC, AC, A, B, C.
4 2 2 SK CK =It is super key Whose proper subset is not a super key.
ABC YES NO
AC YES NO
A YES YES
BC YES YES
CANDIDATE KEYS = A, BC.
5. PRIMARY KEY : It is a candidate key that is most appropriate
to become the main key in a table .
In the above candidate keys we can select A OR BC as primary key IF we select
as primary key then ‘BC ‘is a secondary key
6. COMPOSITE KEY
• Composite key consists of two or more attributes that uniquely identifies any record in a
table .
• In this table student_id and subject _id together will form the composite key.
Student _id Subject _id marks Exam_name
7. FOREIGN KEY
• It is an attribute in a table which is used to define its relationship
with another table
• BRANCH TABLE
BRANCH_CODE BRANCH_NAME HOD
8. FOREIGN KEY
• STUDENT TABLE
• In student and branch relationship the branch code can be made as a foreign
key
SID REG_ID NAME BRANCH_CODE EMAIL