Lec-9: What is CANDIDATE KEY and PRIMARY key | Full Concept | Most suitable examples | DBMS
Understanding Candidate Keys in Databases
Introduction to Keys
- A key is a fundamental concept in databases, essential for identifying records uniquely within a table.
- In the context of a student table, attributes like student name, city, and age are examples of normal attributes.
Purpose of Keys
- The primary function of a key is to uniquely identify any two tuples (rows) in a database table.
- Without keys, confusion arises when identical rows exist; it becomes unclear if they represent the same entity or different entities with coinciding values.
Importance of Unique Identification
- Online databases face challenges in distinguishing between duplicate entries without unique identifiers.
- Attributes such as student ID, roll number, or other personal identifiers help clarify whether records refer to the same individual.
Examples of Candidate Keys
- Potential candidate keys include unique identifiers like Aadhar card numbers, roll numbers, voter IDs, and phone numbers that can distinguish between records.
- For instance, if roll numbers are added to the student table, each value must be unique across all entries.
Defining Candidate Key Sets
- A collection of all potential unique identifiers forms what is known as the candidate key set.
- This set includes various attributes such as Aadhar card numbers and email IDs that cannot repeat among different individuals.
Selection of Primary Key
- From the candidate key set, one attribute is selected as the primary key based on its appropriateness for identification.
- It’s crucial for students to understand how to design candidate keys effectively and select an appropriate primary key since it plays a vital role in database integrity.
Turn any video into a summary like this
YouTube links, meetings, lectures — with transcripts, search, and chat.