SlideShare a Scribd company logo
1 of 9
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 .
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
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
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.
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
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
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
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
GRACIAS……

More Related Content

Similar to Keys in DBMS.pptx

5. relational structure
5. relational structure5. relational structure
5. relational structurekhoahuy82
 
DBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxDBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxsajinis5
 
DBMS Keys.pptx
DBMS Keys.pptxDBMS Keys.pptx
DBMS Keys.pptxAryanGour1
 
2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptxvidyahulkman
 
Database normalization
Database normalizationDatabase normalization
Database normalizationEdward Blurock
 
Joins & constraints
Joins & constraintsJoins & constraints
Joins & constraintsVENNILAV6
 
Presentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptxPresentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptxShumailaSajjad
 
Excel functions, formulas, Prepared by singh institute RK Puram
Excel functions, formulas, Prepared by singh institute RK PuramExcel functions, formulas, Prepared by singh institute RK Puram
Excel functions, formulas, Prepared by singh institute RK PuramSimranjit Singh Chopra
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database ModelShishir Aryal
 

Similar to Keys in DBMS.pptx (18)

5. relational structure
5. relational structure5. relational structure
5. relational structure
 
DBMS_Keys.pdf
DBMS_Keys.pdfDBMS_Keys.pdf
DBMS_Keys.pdf
 
ER diagram
ER diagramER diagram
ER diagram
 
DBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptxDBMS-Keys , Attributes and Constraints.pptx
DBMS-Keys , Attributes and Constraints.pptx
 
DBMS Keys.pptx
DBMS Keys.pptxDBMS Keys.pptx
DBMS Keys.pptx
 
2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx
 
Dbms relational data model and sql queries
Dbms relational data model and sql queries Dbms relational data model and sql queries
Dbms relational data model and sql queries
 
B & c
B & cB & c
B & c
 
Database normalization
Database normalizationDatabase normalization
Database normalization
 
DBMS-Unit-2.pptx
DBMS-Unit-2.pptxDBMS-Unit-2.pptx
DBMS-Unit-2.pptx
 
DBMS
DBMSDBMS
DBMS
 
Joins & constraints
Joins & constraintsJoins & constraints
Joins & constraints
 
Sql Tutorials
Sql TutorialsSql Tutorials
Sql Tutorials
 
Presentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptxPresentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptx
 
Excel functions, formulas, Prepared by singh institute RK Puram
Excel functions, formulas, Prepared by singh institute RK PuramExcel functions, formulas, Prepared by singh institute RK Puram
Excel functions, formulas, Prepared by singh institute RK Puram
 
Relational model
Relational modelRelational model
Relational model
 
DATABASE DESIGN.pptx
DATABASE DESIGN.pptxDATABASE DESIGN.pptx
DATABASE DESIGN.pptx
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 

Recently uploaded

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationnomboosow
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdfQucHHunhnh
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDThiyagu K
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...PsychoTech Services
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024Janet Corral
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 

Recently uploaded (20)

Interactive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communicationInteractive Powerpoint_How to Master effective communication
Interactive Powerpoint_How to Master effective communication
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
Measures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SDMeasures of Dispersion and Variability: Range, QD, AD and SD
Measures of Dispersion and Variability: Range, QD, AD and SD
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
IGNOU MSCCFT and PGDCFT Exam Question Pattern: MCFT003 Counselling and Family...
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
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