SlideShare a Scribd company logo
4
Most read
10
Most read
Database Keys
Presented by Rahul Mishra
Database keys
Keys are very important part of Relational database.
They are used to establish and identify relation
between tables.
They also ensure that each record within a table can
be uniquely identified by combination of one or
more fields within a table.
Types:-
1. Primary Key
2. Candidate Key
3. Alternate Key
4. Composite
5. Super Key
6. Foeign Key
1. Super Key
Emp_code Name Address Dept_ID
It is an attribute or
an set of attribute
whose combined
value uniquely
identifies a tuple
within a relation.
{Emp_code, Name, Address, Dept_ID},
{Emp_code, Name, Address},
{Name, Address},
{Emp_code}, etc.
2. Candidate Key
Emp_code Name Address Dept_ID
It is a minimal super
key i.e., a super key
which does not have
any proper subset
which is also a super
key.
{Emp_code} and {Name, Address}
3. Primary Key
Emp_code Name Address Dept_ID
A candidate key
which is actually
chosen by database
designer as the
means of uniquely
identifying the tuple
within a relation.
{Emp_code}
4. Alternate Key
Emp_code Name Address Dept_ID
All candidate keys
which are not
chosen as a primary
key is called an
alternate key.
{Name, Address}
5. Composite Key
Emp_code Name Address Dept_ID
A primary key
formed by
combination of one
or more attributes.
{Name, Address}
6. Foreign Key Emp_code Name Address Dept_ID
A foreign key is a
field (or collection of
fields) in one table
that uniquely
identifies a row of
another table or the
same table.
Department
Dept_ID Dept_Name
Employee
Dept_ID – Primary Key in Department Table
Foreign Key in Employee Table
Thank You!
Here is a
potato for
you!!! 

More Related Content

PPTX
Key and its different types
PPT
Database Keys
PPT
Joins in SQL
PPTX
Types Of Keys in DBMS
PPTX
SQL JOIN
PPTX
Relational model
PDF
Create table
PPTX
DBMS Keys
Key and its different types
Database Keys
Joins in SQL
Types Of Keys in DBMS
SQL JOIN
Relational model
Create table
DBMS Keys

What's hot (20)

PPTX
SQL Joins.pptx
PPTX
STRUCTURE OF SQL QUERIES
PPT
Types Of Join In Sql Server - Join With Example In Sql Server
PPTX
Types of keys in database | SQL
PPTX
joins in database
PDF
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
PPT
Constraints In Sql
PPTX
Degree of relationship set
PDF
Everything about Database JOINS and Relationships
PPTX
basic structure of SQL FINAL.pptx
PPT
Aggregate functions
PPTX
Relational Algebra,Types of join
PPTX
PPTX
Dbms keys
DOC
Dbms lab questions
PPTX
Types of keys dbms
PPTX
Integrity Constraints
PPTX
Normal forms
PPT
PPTX
Sql operator
SQL Joins.pptx
STRUCTURE OF SQL QUERIES
Types Of Join In Sql Server - Join With Example In Sql Server
Types of keys in database | SQL
joins in database
Dbms Notes Lecture 9 : Specialization, Generalization and Aggregation
Constraints In Sql
Degree of relationship set
Everything about Database JOINS and Relationships
basic structure of SQL FINAL.pptx
Aggregate functions
Relational Algebra,Types of join
Dbms keys
Dbms lab questions
Types of keys dbms
Integrity Constraints
Normal forms
Sql operator
Ad

Similar to Database keys (20)

DOCX
DATA BASE KEYS.docx
PPTX
PPTX
The Relational Database Model
PPTX
DBMS-Unit-2.pptx
PDF
Keys in Database
PPTX
Keys presentation
PPTX
Understanding Entity Relationship Models
PDF
2.2 keys
DOCX
Doc 20191022-wa0041
PPTX
2. Relational_Data_Model_Keys_10b.pptx
PPTX
SQL_DBMS_KEYS.pptx
PPTX
Keys.pptx
PDF
Database Systems - Relational Data Model (Chapter 2)
PDF
Relational Database Model Database Management system
PPT
Lecture 07 relational database management system
PPTX
DBMS
PPTX
Types of keys in dbms
DOCX
Keys used in database
PPTX
relational data model in RDBMS USING KEYS.pptx
PPTX
relational data model in DBMS AND KEYS.pptx
DATA BASE KEYS.docx
The Relational Database Model
DBMS-Unit-2.pptx
Keys in Database
Keys presentation
Understanding Entity Relationship Models
2.2 keys
Doc 20191022-wa0041
2. Relational_Data_Model_Keys_10b.pptx
SQL_DBMS_KEYS.pptx
Keys.pptx
Database Systems - Relational Data Model (Chapter 2)
Relational Database Model Database Management system
Lecture 07 relational database management system
DBMS
Types of keys in dbms
Keys used in database
relational data model in RDBMS USING KEYS.pptx
relational data model in DBMS AND KEYS.pptx
Ad

Recently uploaded (20)

PDF
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
PPTX
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
PPTX
Business Ppt On Nestle.pptx huunnnhhgfvu
PDF
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
PPTX
IB Computer Science - Internal Assessment.pptx
PPTX
Data_Analytics_and_PowerBI_Presentation.pptx
PPTX
Supervised vs unsupervised machine learning algorithms
PDF
Business Analytics and business intelligence.pdf
PPTX
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
PDF
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
PPTX
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
PPTX
Introduction to machine learning and Linear Models
PPTX
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
PPTX
oil_refinery_comprehensive_20250804084928 (1).pptx
PPTX
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
PPTX
Acceptance and paychological effects of mandatory extra coach I classes.pptx
PPTX
1_Introduction to advance data techniques.pptx
PPTX
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
PPTX
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
PDF
Mega Projects Data Mega Projects Data
TRAFFIC-MANAGEMENT-AND-ACCIDENT-INVESTIGATION-WITH-DRIVING-PDF-FILE.pdf
AI Strategy room jwfjksfksfjsjsjsjsjfsjfsj
Business Ppt On Nestle.pptx huunnnhhgfvu
Recruitment and Placement PPT.pdfbjfibjdfbjfobj
IB Computer Science - Internal Assessment.pptx
Data_Analytics_and_PowerBI_Presentation.pptx
Supervised vs unsupervised machine learning algorithms
Business Analytics and business intelligence.pdf
DISORDERS OF THE LIVER, GALLBLADDER AND PANCREASE (1).pptx
168300704-gasification-ppt.pdfhghhhsjsjhsuxush
01_intro xxxxxxxxxxfffffffffffaaaaaaaaaaafg
Introduction to machine learning and Linear Models
Introduction to Basics of Ethical Hacking and Penetration Testing -Unit No. 1...
oil_refinery_comprehensive_20250804084928 (1).pptx
advance b rammar.pptxfdgdfgdfsgdfgsdgfdfgdfgsdfgdfgdfg
Acceptance and paychological effects of mandatory extra coach I classes.pptx
1_Introduction to advance data techniques.pptx
Introduction to Firewall Analytics - Interfirewall and Transfirewall.pptx
MODULE 8 - DISASTER risk PREPAREDNESS.pptx
Mega Projects Data Mega Projects Data

Database keys

  • 2. Database keys Keys are very important part of Relational database. They are used to establish and identify relation between tables. They also ensure that each record within a table can be uniquely identified by combination of one or more fields within a table.
  • 3. Types:- 1. Primary Key 2. Candidate Key 3. Alternate Key 4. Composite 5. Super Key 6. Foeign Key
  • 4. 1. Super Key Emp_code Name Address Dept_ID It is an attribute or an set of attribute whose combined value uniquely identifies a tuple within a relation. {Emp_code, Name, Address, Dept_ID}, {Emp_code, Name, Address}, {Name, Address}, {Emp_code}, etc.
  • 5. 2. Candidate Key Emp_code Name Address Dept_ID It is a minimal super key i.e., a super key which does not have any proper subset which is also a super key. {Emp_code} and {Name, Address}
  • 6. 3. Primary Key Emp_code Name Address Dept_ID A candidate key which is actually chosen by database designer as the means of uniquely identifying the tuple within a relation. {Emp_code}
  • 7. 4. Alternate Key Emp_code Name Address Dept_ID All candidate keys which are not chosen as a primary key is called an alternate key. {Name, Address}
  • 8. 5. Composite Key Emp_code Name Address Dept_ID A primary key formed by combination of one or more attributes. {Name, Address}
  • 9. 6. Foreign Key Emp_code Name Address Dept_ID A foreign key is a field (or collection of fields) in one table that uniquely identifies a row of another table or the same table. Department Dept_ID Dept_Name Employee Dept_ID – Primary Key in Department Table Foreign Key in Employee Table
  • 10. Thank You! Here is a potato for you!!! 