SlideShare a Scribd company logo
2
Most read
3
Most read
5
Most read
DATABASE KEYS
Higher Computing Science
KEYS
Primary Key
• A primary key is a column whose values uniquely identify a record.
Foreign Key
A foreign key is a column in a relational table that provides link to a
related table.
COMPOUND KEY
• A compound key is where two or more attributes are used to uniquely
identify each record in a table.
• Each attribute from the compound key is a primary key from a different
table.
• A compound key is used when no single attribute in a table can be used
as a primary key.
COMPOUND KEY EXAMPLE
Members Bikes Hire
MemberID BikeID MemberID*
Name Make BikeID*
Address Colour HireDate
Telephone MT338X440
Two-Wheel-Rental Inc hires bikes to customers for one day. They have a
relational database with three tables as shown below:
COMPOUND KEY EXAMPLE
Members Bikes Hire
MemberID BikeID MemberID*
Name Make BikeID*
Address Colour HireDate
Telephone MT338X440
The Hire table needs a compound key of MemberID, BikeID and HireDate.
• MemberID alone can’t be used – a member can make more than one
hire
• BikeID alone can’t be used – a bike can be hired by more than one
member
• MemberID and BikeID can’t be used – a member could hire the same
bike on a different day

More Related Content

PDF
IPL Data Analysis using Data Science
PPTX
Semantics at Play: Electronic Arts' Linked Data Journey
PPTX
Presentation OF DBMS-2.pptx
PPTX
Keys in dbms(UNIT 2)
PPTX
Dbms keysppt
PPTX
Keys_in_DBMS_VALID_INFORMATION_IS_AVAILA
PPTX
PPTX
Keys.pptx
IPL Data Analysis using Data Science
Semantics at Play: Electronic Arts' Linked Data Journey
Presentation OF DBMS-2.pptx
Keys in dbms(UNIT 2)
Dbms keysppt
Keys_in_DBMS_VALID_INFORMATION_IS_AVAILA
Keys.pptx

Similar to Compound Keys (20)

PPTX
Keys in SQL.........................pptx
PPTX
Copy of Templates ............. (1).pptx
PPTX
Copy of Templates & Apps............................. (1).pptx
PPTX
Types Of Keys in DBMS
PDF
computer-210809080138.pdf
PDF
2.2 keys
DOCX
Doc 20191022-wa0041
PPTX
key.pptx
PPTX
DBMS Keys.pptx
PPTX
Keys and its Importance in DBMS and RDBMS
PPTX
V35 keys-c
PPTX
DBMS key topic Presentation slide 1.pptx
PPTX
Database Keys & Relationship
PPTX
Keys presentation
DOCX
Keys used in database
DOCX
DATA BASE KEYS.docx
PPTX
Dbms keys
PDF
Keys in Database
PPTX
Types of keys in dbms
PPTX
Relational Data Model| Database system.pptx
Keys in SQL.........................pptx
Copy of Templates ............. (1).pptx
Copy of Templates & Apps............................. (1).pptx
Types Of Keys in DBMS
computer-210809080138.pdf
2.2 keys
Doc 20191022-wa0041
key.pptx
DBMS Keys.pptx
Keys and its Importance in DBMS and RDBMS
V35 keys-c
DBMS key topic Presentation slide 1.pptx
Database Keys & Relationship
Keys presentation
Keys used in database
DATA BASE KEYS.docx
Dbms keys
Keys in Database
Types of keys in dbms
Relational Data Model| Database system.pptx
Ad

More from Forrester High School (20)

PPTX
Program Design
PPTX
Database Evaluation
PPTX
PPTX
Database Query Design
PPTX
Data Dictionary
PPTX
Entity Occurrence Diagrams
PPTX
Entity Relationship Diagrams
PPTX
Database Analysis
PPTX
Software Evaluation
PPTX
Software Testing
PPTX
Standard Algorithms
PPTX
File Handling
PPTX
Python Predefined Functions
PPTX
Python Substrings
PPTX
Variable Scope
PPTX
Sub-programs
PPTX
Records in Python
PPTX
Parallel arrays in python
PPT
SDD Predefined Functions
Program Design
Database Evaluation
Database Query Design
Data Dictionary
Entity Occurrence Diagrams
Entity Relationship Diagrams
Database Analysis
Software Evaluation
Software Testing
Standard Algorithms
File Handling
Python Predefined Functions
Python Substrings
Variable Scope
Sub-programs
Records in Python
Parallel arrays in python
SDD Predefined Functions
Ad

Recently uploaded (20)

PPTX
Unit 4 Computer Architecture Multicore Processor.pptx
PDF
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
PPTX
202450812 BayCHI UCSC-SV 20250812 v17.pptx
PPTX
Introduction to Building Materials
PDF
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
PDF
HVAC Specification 2024 according to central public works department
PDF
Weekly quiz Compilation Jan -July 25.pdf
PDF
LDMMIA Reiki Yoga Finals Review Spring Summer
PDF
Trump Administration's workforce development strategy
PDF
Indian roads congress 037 - 2012 Flexible pavement
PPTX
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
PPTX
History, Philosophy and sociology of education (1).pptx
PDF
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
PPTX
Introduction to pro and eukaryotes and differences.pptx
PPTX
Computer Architecture Input Output Memory.pptx
PPTX
B.Sc. DS Unit 2 Software Engineering.pptx
PPTX
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
PDF
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
PDF
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
PDF
Paper A Mock Exam 9_ Attempt review.pdf.
Unit 4 Computer Architecture Multicore Processor.pptx
OBE - B.A.(HON'S) IN INTERIOR ARCHITECTURE -Ar.MOHIUDDIN.pdf
202450812 BayCHI UCSC-SV 20250812 v17.pptx
Introduction to Building Materials
CISA (Certified Information Systems Auditor) Domain-Wise Summary.pdf
HVAC Specification 2024 according to central public works department
Weekly quiz Compilation Jan -July 25.pdf
LDMMIA Reiki Yoga Finals Review Spring Summer
Trump Administration's workforce development strategy
Indian roads congress 037 - 2012 Flexible pavement
Chinmaya Tiranga Azadi Quiz (Class 7-8 )
History, Philosophy and sociology of education (1).pptx
احياء السادس العلمي - الفصل الثالث (التكاثر) منهج متميزين/كلية بغداد/موهوبين
Introduction to pro and eukaryotes and differences.pptx
Computer Architecture Input Output Memory.pptx
B.Sc. DS Unit 2 Software Engineering.pptx
Onco Emergencies - Spinal cord compression Superior vena cava syndrome Febr...
Vision Prelims GS PYQ Analysis 2011-2022 www.upscpdf.com.pdf
David L Page_DCI Research Study Journey_how Methodology can inform one's prac...
Paper A Mock Exam 9_ Attempt review.pdf.

Compound Keys

  • 2. KEYS Primary Key • A primary key is a column whose values uniquely identify a record. Foreign Key A foreign key is a column in a relational table that provides link to a related table.
  • 3. COMPOUND KEY • A compound key is where two or more attributes are used to uniquely identify each record in a table. • Each attribute from the compound key is a primary key from a different table. • A compound key is used when no single attribute in a table can be used as a primary key.
  • 4. COMPOUND KEY EXAMPLE Members Bikes Hire MemberID BikeID MemberID* Name Make BikeID* Address Colour HireDate Telephone MT338X440 Two-Wheel-Rental Inc hires bikes to customers for one day. They have a relational database with three tables as shown below:
  • 5. COMPOUND KEY EXAMPLE Members Bikes Hire MemberID BikeID MemberID* Name Make BikeID* Address Colour HireDate Telephone MT338X440 The Hire table needs a compound key of MemberID, BikeID and HireDate. • MemberID alone can’t be used – a member can make more than one hire • BikeID alone can’t be used – a bike can be hired by more than one member • MemberID and BikeID can’t be used – a member could hire the same bike on a different day