SlideShare a Scribd company logo
1 of 18
DatabaseDatabase
ManagementManagement
SystemSystem
Lecture - 8
Today’s Overview
Key and its different types
Relationships in E-R Data
Model
Types of relationships
Key Attributes
An attribute or set of attributes to identify
an entity instance uniquely
Types
 Super key
 Candidate key
 Primary key
 Secondary and Alternate keys
Example of Key
StdId StdName Address ClName CurSem
S1020 Suhail Dar Mareer Hassan MCS 4
S1038 Shoaib Baber Model Town BCS 3
S1015 Tahira Ejaz Wah Cantt MCS 2
S1018 Arif Mehmood Satellite Town BIT 4
S1025 Suhail Shah Garhi Shahoo BCS 6
Simple or Composite Key
A key consisting of single attribute is
called simple key, e.g., StudID, itemNo
A key consisting of more than one
attribute is known as composite key,
like {Program_Code,Course_Code}
ProgCode CourseCode MarksAlloc CrHrs
MCS DS 100 3
MCS DBS 100 3
MBA DBS 100 3
BCS NW 100 3
OFFERING
Composite Key Example
Super Key
Definition same as of key
For example, for EMPLOYEE and
STUDENT entity types EmpID and
StudID are the superkeys
respectively.
Composite Key Example
StdId StdName Address ClName CurSem
S1020 Suhail Dar Mareer Hassan MCS 4
S1038 Shoaib Baber Model Town BCS 3
S1015 Tahira Ejaz Wah Cantt MCS 2
S1018 Arif Mehmood Satellite Town BIT 4
S1025 Suhail Shah Garhi Shahoo BCS 6
Super Key
Any set of attributes containing a
super key is also a super key
since it too uniquely identifies an
entity e.g. {StudID, major}
Super Keys
StdId StdName Address ClName CurSem
S1020 Suhail Dar Mareer Hassan MCS 4
S1038 Shoaib Baber Model Town BCS 3
S1015 Tahira Ejaz Wah Cantt MCS 2
S1018 Arif Mehmood Satellite Town BIT 4
S1025 Suhail Shah Garhi Shahoo BCS 6
Candidate Key
A candidate key is the super key that
does not contain extra attributes. It
might have more than one attribute
that uniquely identifies an entity. e.g
{name, address}
Candidate Keys
A super key such that no proper
subset of its attributes is itself a super
key. e.g. {StudID, Major} is not a
candidate key because it contains a
subset, StudID, that is a super key
CK Example
StdId StdName Address ClName CurSem
S1020 Suhail Dar Mareer Hassan MCS 4
S1038 Shoaib Baber Model Town BCS 3
S1015 Tahira Ejaz Wah Cantt MCS 2
S1018 Arif Mehmood Satellite Town BIT 4
S1025 Suhail Shah Garhi Shahoo BCS 6
Primary Key
A primary key is the main/chosen
candidate key from the possible
set of candidate keys that is most
suitable for entity identification.
Primary Key
It may be a single attribute or a
composite key.
None of its attributes can have
NULL values.
Primary Key
The other candidate keys called
Alternate keys provide another
method of accessing records.
Need for Key
Need for unique identification
and access
Secondary Keys: We access
on something not necessarily
unique
DatabaseDatabase
ManagementManagement
SystemSystem
Lecture - 8

More Related Content

Recently uploaded

MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MysoreMuleSoftMeetup
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 

Recently uploaded (20)

Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024UChicago CMSC 23320 - The Best Commit Messages of 2024
UChicago CMSC 23320 - The Best Commit Messages of 2024
 
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
MuleSoft Integration with AWS Textract | Calling AWS Textract API |AWS - Clou...
 
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community PartnershipsSpring gala 2024 photo slideshow - Celebrating School-Community Partnerships
Spring gala 2024 photo slideshow - Celebrating School-Community Partnerships
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...Andreas Schleicher presents at the launch of What does child empowerment mean...
Andreas Schleicher presents at the launch of What does child empowerment mean...
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
Observing-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptxObserving-Correct-Grammar-in-Making-Definitions.pptx
Observing-Correct-Grammar-in-Making-Definitions.pptx
 
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUMDEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
DEMONSTRATION LESSON IN ENGLISH 4 MATATAG CURRICULUM
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
How to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptxHow to Manage Website in Odoo 17 Studio App.pptx
How to Manage Website in Odoo 17 Studio App.pptx
 
The Liver & Gallbladder (Anatomy & Physiology).pptx
The Liver &  Gallbladder (Anatomy & Physiology).pptxThe Liver &  Gallbladder (Anatomy & Physiology).pptx
The Liver & Gallbladder (Anatomy & Physiology).pptx
 

Featured

How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
ThinkNow
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
Kurio // The Social Media Age(ncy)
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Database management systems cs403 power point slides lecture 08

  • 2. Today’s Overview Key and its different types Relationships in E-R Data Model Types of relationships
  • 3. Key Attributes An attribute or set of attributes to identify an entity instance uniquely Types  Super key  Candidate key  Primary key  Secondary and Alternate keys
  • 4. Example of Key StdId StdName Address ClName CurSem S1020 Suhail Dar Mareer Hassan MCS 4 S1038 Shoaib Baber Model Town BCS 3 S1015 Tahira Ejaz Wah Cantt MCS 2 S1018 Arif Mehmood Satellite Town BIT 4 S1025 Suhail Shah Garhi Shahoo BCS 6
  • 5. Simple or Composite Key A key consisting of single attribute is called simple key, e.g., StudID, itemNo A key consisting of more than one attribute is known as composite key, like {Program_Code,Course_Code}
  • 6. ProgCode CourseCode MarksAlloc CrHrs MCS DS 100 3 MCS DBS 100 3 MBA DBS 100 3 BCS NW 100 3 OFFERING Composite Key Example
  • 7. Super Key Definition same as of key For example, for EMPLOYEE and STUDENT entity types EmpID and StudID are the superkeys respectively.
  • 8. Composite Key Example StdId StdName Address ClName CurSem S1020 Suhail Dar Mareer Hassan MCS 4 S1038 Shoaib Baber Model Town BCS 3 S1015 Tahira Ejaz Wah Cantt MCS 2 S1018 Arif Mehmood Satellite Town BIT 4 S1025 Suhail Shah Garhi Shahoo BCS 6
  • 9. Super Key Any set of attributes containing a super key is also a super key since it too uniquely identifies an entity e.g. {StudID, major}
  • 10. Super Keys StdId StdName Address ClName CurSem S1020 Suhail Dar Mareer Hassan MCS 4 S1038 Shoaib Baber Model Town BCS 3 S1015 Tahira Ejaz Wah Cantt MCS 2 S1018 Arif Mehmood Satellite Town BIT 4 S1025 Suhail Shah Garhi Shahoo BCS 6
  • 11. Candidate Key A candidate key is the super key that does not contain extra attributes. It might have more than one attribute that uniquely identifies an entity. e.g {name, address}
  • 12. Candidate Keys A super key such that no proper subset of its attributes is itself a super key. e.g. {StudID, Major} is not a candidate key because it contains a subset, StudID, that is a super key
  • 13. CK Example StdId StdName Address ClName CurSem S1020 Suhail Dar Mareer Hassan MCS 4 S1038 Shoaib Baber Model Town BCS 3 S1015 Tahira Ejaz Wah Cantt MCS 2 S1018 Arif Mehmood Satellite Town BIT 4 S1025 Suhail Shah Garhi Shahoo BCS 6
  • 14. Primary Key A primary key is the main/chosen candidate key from the possible set of candidate keys that is most suitable for entity identification.
  • 15. Primary Key It may be a single attribute or a composite key. None of its attributes can have NULL values.
  • 16. Primary Key The other candidate keys called Alternate keys provide another method of accessing records.
  • 17. Need for Key Need for unique identification and access Secondary Keys: We access on something not necessarily unique