0% found this document useful (0 votes)
25 views14 pages

Concept of Keys in DBMS

Uploaded by

rajithashibu16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
25 views14 pages

Concept of Keys in DBMS

Uploaded by

rajithashibu16
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Concept of Keys in DBMS

Understanding Keys in Database


Management Systems
Your Name
Date
What is a DBMS?
• Definition: A Database Management System
(DBMS) is software that uses a standard
method to store and organize data.

• Examples: MySQL, PostgreSQL, Oracle, SQL


Server.
Why are Keys Important?
• • Ensure data integrity and uniqueness.
• • Establish relationships between tables.
• • Facilitate data retrieval and organization.
Different Types of Keys
• • Primary Key
• • Foreign Key
• • Candidate Key
• • Super Key
• • Composite Key
• • Alternate Key
Primary Key
• • Uniquely identifies each record in a table.
• • Cannot contain NULL values.

• Example:
• Table: Students
• Columns: StudentID (Primary Key), FirstName,
LastName
• Example Entry: (1, 'John', 'Doe')
Foreign Key
• • Establishes a link between two tables.
• • Refers to the primary key in another table.

• Example:
• Table: Enrollments
• Columns: EnrollmentID, StudentID (Foreign
Key), CourseID (Foreign Key)
• References: StudentID from Students table,
CourseID from Courses table
Candidate Key
• • A minimal set of attributes that can uniquely
identify a record.
• • Every table can have multiple candidate
keys.

• Example:
• Table: Users
• Columns: UserID, Email, PhoneNumber
• Candidate Keys: Email, PhoneNumber
Super Key
• • A set of one or more attributes that can
uniquely identify a record.
• • May contain extra attributes not necessary
for unique identification.

• Example:
• Table: Students
• Columns: StudentID, FirstName, LastName
• Super Key: {StudentID, FirstName}, {StudentID,
Composite Key
• • A key that consists of two or more
attributes.
• • Uniquely identifies a record when combined.

• Example:
• Table: Enrollments
• Columns: EnrollmentID, CourseID, StudentID
• Composite Key: {CourseID, StudentID}
Alternate Key
• • Any candidate key that is not chosen as the
primary key.

• Example:
• Table: Users
• Columns: UserID (Primary Key), Email,
PhoneNumber
• Alternate Key: Email, PhoneNumber
Example Database Schema
• Diagram showing relationships using primary
and foreign keys.

• Example:
• Students Table: StudentID (Primary Key),
FirstName, LastName
• Courses Table: CourseID (Primary Key),
CourseName
• Enrollments Table: EnrollmentID, StudentID
(Foreign Key), CourseID (Foreign Key)
Summary of Keys
• • Recap of key types and their importance.
• • Emphasize the role of keys in maintaining
data integrity and relationships.
Questions?
• • Open the floor for questions.
• • Encourage discussion on specific key-related
queries.
References
• • List of textbooks, articles, or websites used
for the presentation content.

You might also like