SlideShare a Scribd company logo
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

What's hot

Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
Damian T. Gordon
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
Sharad Dubey
 
oracle Sql constraint
oracle  Sql constraint oracle  Sql constraint
oracle Sql constraint
home
 
Keys in dbms
Keys in dbmsKeys in dbms
Keys in dbms
shalini s
 
Sql commands
Sql commandsSql commands
Sql commands
Prof. Dr. K. Adisesha
 
DBMS Keys
DBMS KeysDBMS Keys
DBMS Keys
Tarun Maheshwari
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
madhav bansal
 
Types of keys in dbms
Types of keys in dbmsTypes of keys in dbms
Types of keys in dbms
darshhingu
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
Anurag
 
joins in database
 joins in database joins in database
joins in database
Sultan Arshad
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
programmings guru
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
Hitesh Mohapatra
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
Vraj Patel
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
Nishant Munjal
 
DML Commands
DML CommandsDML Commands
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
wmassie
 
Database Keys & Relationship
Database Keys & RelationshipDatabase Keys & Relationship
Database Keys & Relationship
Bellal Hossain
 
Packages - PL/SQL
Packages - PL/SQLPackages - PL/SQL
Packages - PL/SQL
Esmita Gupta
 
Trigger
TriggerTrigger
Nested queries in database
Nested queries in databaseNested queries in database
Nested queries in database
Satya P. Joshi
 

What's hot (20)

Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
SQL(DDL & DML)
SQL(DDL & DML)SQL(DDL & DML)
SQL(DDL & DML)
 
oracle Sql constraint
oracle  Sql constraint oracle  Sql constraint
oracle Sql constraint
 
Keys in dbms
Keys in dbmsKeys in dbms
Keys in dbms
 
Sql commands
Sql commandsSql commands
Sql commands
 
DBMS Keys
DBMS KeysDBMS Keys
DBMS Keys
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Types of keys in dbms
Types of keys in dbmsTypes of keys in dbms
Types of keys in dbms
 
Constraints In Sql
Constraints In SqlConstraints In Sql
Constraints In Sql
 
joins in database
 joins in database joins in database
joins in database
 
Types Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql ServerTypes Of Join In Sql Server - Join With Example In Sql Server
Types Of Join In Sql Server - Join With Example In Sql Server
 
Normalization in DBMS
Normalization in DBMSNormalization in DBMS
Normalization in DBMS
 
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
FUNCTION DEPENDENCY  AND TYPES & EXAMPLEFUNCTION DEPENDENCY  AND TYPES & EXAMPLE
FUNCTION DEPENDENCY AND TYPES & EXAMPLE
 
Relational Data Model Introduction
Relational Data Model IntroductionRelational Data Model Introduction
Relational Data Model Introduction
 
DML Commands
DML CommandsDML Commands
DML Commands
 
Database Relationships
Database RelationshipsDatabase Relationships
Database Relationships
 
Database Keys & Relationship
Database Keys & RelationshipDatabase Keys & Relationship
Database Keys & Relationship
 
Packages - PL/SQL
Packages - PL/SQLPackages - PL/SQL
Packages - PL/SQL
 
Trigger
TriggerTrigger
Trigger
 
Nested queries in database
Nested queries in databaseNested queries in database
Nested queries in database
 

Similar to Database keys

DATA BASE KEYS.docx
DATA BASE KEYS.docxDATA BASE KEYS.docx
DATA BASE KEYS.docx
AdityaVerma196750
 
B & c
B & cB & c
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
Shishir Aryal
 
DBMS-Unit-2.pptx
DBMS-Unit-2.pptxDBMS-Unit-2.pptx
DBMS-Unit-2.pptx
Abhinayacheekati
 
Keys in Database
Keys in DatabaseKeys in Database
Keys in Database
A. S. M. Shafi
 
Keys presentation
Keys presentationKeys presentation
Keys presentation
mubeenkiran
 
Understanding Entity Relationship Models
Understanding Entity Relationship ModelsUnderstanding Entity Relationship Models
Understanding Entity Relationship Models
HamzaNadeem527928
 
2.2 keys
2.2 keys2.2 keys
2.2 keys
ELIMENG
 
Doc 20191022-wa0041
Doc 20191022-wa0041Doc 20191022-wa0041
Doc 20191022-wa0041
university of Gujrat, pakistan
 
2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx
vidyahulkman
 
SQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptxSQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptx
rahulsharma571283
 
Keys.pptx
Keys.pptxKeys.pptx
Keys.pptx
revathi s
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
Vidyasagar Mundroy
 
Lecture 07 relational database management system
Lecture 07 relational database management systemLecture 07 relational database management system
Lecture 07 relational database management system
emailharmeet
 
DBMS
DBMSDBMS
DBMS
emran nur
 
Keys used in database
Keys used in databaseKeys used in database
Keys used in database
university of Gujrat, pakistan
 
ans_dbms.pdf
ans_dbms.pdfans_dbms.pdf
ans_dbms.pdf
SandipPradhan23
 
Presentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptxPresentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptx
ShumailaSajjad
 
key.pptx
key.pptxkey.pptx
key.pptx
laptophp39
 
DBMS_Keys.pdf
DBMS_Keys.pdfDBMS_Keys.pdf
DBMS_Keys.pdf
DianneParaase
 

Similar to Database keys (20)

DATA BASE KEYS.docx
DATA BASE KEYS.docxDATA BASE KEYS.docx
DATA BASE KEYS.docx
 
B & c
B & cB & c
B & c
 
The Relational Database Model
The Relational Database ModelThe Relational Database Model
The Relational Database Model
 
DBMS-Unit-2.pptx
DBMS-Unit-2.pptxDBMS-Unit-2.pptx
DBMS-Unit-2.pptx
 
Keys in Database
Keys in DatabaseKeys in Database
Keys in Database
 
Keys presentation
Keys presentationKeys presentation
Keys presentation
 
Understanding Entity Relationship Models
Understanding Entity Relationship ModelsUnderstanding Entity Relationship Models
Understanding Entity Relationship Models
 
2.2 keys
2.2 keys2.2 keys
2.2 keys
 
Doc 20191022-wa0041
Doc 20191022-wa0041Doc 20191022-wa0041
Doc 20191022-wa0041
 
2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx2. Relational_Data_Model_Keys_10b.pptx
2. Relational_Data_Model_Keys_10b.pptx
 
SQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptxSQL_DBMS_KEYS.pptx
SQL_DBMS_KEYS.pptx
 
Keys.pptx
Keys.pptxKeys.pptx
Keys.pptx
 
Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)Database Systems - Relational Data Model (Chapter 2)
Database Systems - Relational Data Model (Chapter 2)
 
Lecture 07 relational database management system
Lecture 07 relational database management systemLecture 07 relational database management system
Lecture 07 relational database management system
 
DBMS
DBMSDBMS
DBMS
 
Keys used in database
Keys used in databaseKeys used in database
Keys used in database
 
ans_dbms.pdf
ans_dbms.pdfans_dbms.pdf
ans_dbms.pdf
 
Presentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptxPresentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptx
 
key.pptx
key.pptxkey.pptx
key.pptx
 
DBMS_Keys.pdf
DBMS_Keys.pdfDBMS_Keys.pdf
DBMS_Keys.pdf
 

Recently uploaded

A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
AlessioFois2
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
v7oacc3l
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
nuttdpt
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
aqzctr7x
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
rwarrenll
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
vikram sood
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
jerlynmaetalle
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
Sachin Paul
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
74nqk8xf
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
nuttdpt
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
apvysm8
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
74nqk8xf
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
soxrziqu
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
Roger Valdez
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
g4dpvqap0
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Fernanda Palhano
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
javier ramirez
 
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
zsjl4mimo
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
bopyb
 

Recently uploaded (20)

A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
 
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
一比一原版(UCSF文凭证书)旧金山分校毕业证如何办理
 
一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理一比一原版(UO毕业证)渥太华大学毕业证如何办理
一比一原版(UO毕业证)渥太华大学毕业证如何办理
 
My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.My burning issue is homelessness K.C.M.O.
My burning issue is homelessness K.C.M.O.
 
Global Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headedGlobal Situational Awareness of A.I. and where its headed
Global Situational Awareness of A.I. and where its headed
 
Influence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business PlanInfluence of Marketing Strategy and Market Competition on Business Plan
Influence of Marketing Strategy and Market Competition on Business Plan
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
一比一原版(Chester毕业证书)切斯特大学毕业证如何办理
 
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
一比一原版(UCSB文凭证书)圣芭芭拉分校毕业证如何办理
 
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
办(uts毕业证书)悉尼科技大学毕业证学历证书原版一模一样
 
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
一比一原版(Coventry毕业证书)考文垂大学毕业证如何办理
 
University of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma TranscriptUniversity of New South Wales degree offer diploma Transcript
University of New South Wales degree offer diploma Transcript
 
Everything you wanted to know about LIHTC
Everything you wanted to know about LIHTCEverything you wanted to know about LIHTC
Everything you wanted to know about LIHTC
 
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
一比一原版(Glasgow毕业证书)格拉斯哥大学毕业证如何办理
 
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdfUdemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
Udemy_2024_Global_Learning_Skills_Trends_Report (1).pdf
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
 
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
一比一原版(Harvard毕业证书)哈佛大学毕业证如何办理
 
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
一比一原版(GWU,GW文凭证书)乔治·华盛顿大学毕业证如何办理
 

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!!! 