SlideShare a Scribd company logo
1 of 5
DATA BASE KEYS
A key is an attribute (or set of attributes) that uniquely
identifies any record (from tuple).
EMPLOYEE (referencing/child/foreign/related)
{empid,name,adharno,email_id,deptid}
Emp_id NAME ADHAR
NO
Email id Dept_id
12345 a 11 ab 1
2 a 22 bc 1
3 b 33 cd null
Department(referenced/parent/primary/master)
Dept id loc
1 del
2 kol
3 mumbai
Super keys
Emp id,
Adharnumber
Email id
Emp id, adharnumber,emailid
Adharno , email id
Emp_id ,adharnumber
Empid , name , departmentid
Empid,name,adharno,emailed,deptid
Purpose
Key is used to uniquelyidentify any records or row of data
from the table.
It is used to establish and identify relationshipbetween table.
Super key-
A super key is a combinationof all possible attributes that
can uniquelyidentifythe rows /tuples in the given relation.
Super key is a superset of candidatekeys.
A table can have multiple super keys.
A SK may have additionalattributethat are not needed for
uniqueidentity .
All possible combinationsof attributes.
Candidatekey-
Candidatekey is a minimalsuperkey or a super key with no
redundantattributes.
It is called a minimal superkey because we select a candidate
key from a set of super key such that selected candidatekey
is the minimum attribute required to uniquelyidentify the
table.
Candidatekeys are defined as distinct set of attributes from
which primary key can be selected.
Candidatekeys are not allowedto have null values.
Primary key – choose a key from candidatekey
A primary key is one of the candidatekey chosen by database
designer to uniquelyidentify the tuple in the relation.
The value of pk can never be null
The value of pk must alwaysbe unqiue.
The values of pk can never be changed – no updationis
possible
The value of pk must be assigned when inserting a record
A relation is allowed to have one primary key.
Alternate key – out of all candidatekeys only one is selected
as pk , remaining keys are called alternate keys
Empid- primary key
Name, adharno,email id, dept id- alternate keys.
Foreign key –
A key used to link two tables together
An attribute / set of attribtes in one table that referes to pk
in another table.
The purpose – to ensure referential integrity of the data.
Foreign key references the pk of the table.
Fk can only take pk
Fk can be null.
There is no restriction that foreign key is unique.
Composite key / compound key – a key that has more than
one attribute .
Cust_id Order_id Productcode Product
count
CO1 001 P111 5
CO2 012 P111 8
Co3 012 P222 6
Co1 001 P333 9
{Custid, productcode}
One to many
Relational Query Language – query language is the language
in which user requests informationfrom databse.
e.g sql – structured query language
query – retrieval
2types of query languages
Procedural query language –the user instructs the system to
perform a series of operationsto produce the desired results.
User tellswhat data to be retrieved from data base and how
to retrieve.
Non prodecural query language – (declarative)
User instructs the system to produce the desired results
without telling step by step process.
User tellswhat data to be retrieved from data base but
doesn’t tell how to retrieve it .
Two pure(mathematical)query language
Relationalgebra – procedural query language
It is more operational
Very useful for executionalplan.
Relationalcalculus
Non procedural query language
It is non operational
Tuple relationlcalculus
Domain relationalcalculus
Relationalmodel RDBMS
RELATIONAL algebra,calculus sql
algorithm code
concept reality
theoretical practical

More Related Content

Similar to DATA BASE KEYS.docx

Similar to DATA BASE KEYS.docx (20)

B & c
B & cB & c
B & c
 
key (1).pptx
key (1).pptxkey (1).pptx
key (1).pptx
 
NMEC RD_UNIT 1.ppt
NMEC RD_UNIT 1.pptNMEC RD_UNIT 1.ppt
NMEC RD_UNIT 1.ppt
 
Key and its different types
Key and its different typesKey and its different types
Key and its different types
 
Basic SQL and History
 Basic SQL and History Basic SQL and History
Basic SQL and History
 
Keys in Database
Keys in DatabaseKeys in Database
Keys in Database
 
Ankit
AnkitAnkit
Ankit
 
Presentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptxPresentation OF DBMS-2.pptx
Presentation OF DBMS-2.pptx
 
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLESDATABASE CONCEPTS AND PRACTICAL EXAMPLES
DATABASE CONCEPTS AND PRACTICAL EXAMPLES
 
2.2 keys
2.2 keys2.2 keys
2.2 keys
 
DBMS
DBMSDBMS
DBMS
 
ans_dbms.pdf
ans_dbms.pdfans_dbms.pdf
ans_dbms.pdf
 
Understanding Entity Relationship Models
Understanding Entity Relationship ModelsUnderstanding Entity Relationship Models
Understanding Entity Relationship Models
 
12 SQL
12 SQL12 SQL
12 SQL
 
12 SQL
12 SQL12 SQL
12 SQL
 
Keys.pptx
Keys.pptxKeys.pptx
Keys.pptx
 
Data modelingpresentation
Data modelingpresentationData modelingpresentation
Data modelingpresentation
 
key.pptx
key.pptxkey.pptx
key.pptx
 
Intro to Data warehousing lecture 12
Intro to Data warehousing   lecture 12Intro to Data warehousing   lecture 12
Intro to Data warehousing lecture 12
 
Keys used in database
Keys used in databaseKeys used in database
Keys used in database
 

Recently uploaded

diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...Nguyen Thanh Tu Collection
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaEADTU
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppCeline George
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...Nguyen Thanh Tu Collection
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17Celine George
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismDabee Kamal
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfPondicherry University
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptNishitharanjan Rout
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesAmanpreetKaur157993
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 

Recently uploaded (20)

ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)ESSENTIAL of (CS/IT/IS) class 07 (Networks)
ESSENTIAL of (CS/IT/IS) class 07 (Networks)
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Including Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdfIncluding Mental Health Support in Project Delivery, 14 May.pdf
Including Mental Health Support in Project Delivery, 14 May.pdf
 
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH FORM 50 CÂU TRẮC NGHI...
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
AIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.pptAIM of Education-Teachers Training-2024.ppt
AIM of Education-Teachers Training-2024.ppt
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 

DATA BASE KEYS.docx

  • 1. DATA BASE KEYS A key is an attribute (or set of attributes) that uniquely identifies any record (from tuple). EMPLOYEE (referencing/child/foreign/related) {empid,name,adharno,email_id,deptid} Emp_id NAME ADHAR NO Email id Dept_id 12345 a 11 ab 1 2 a 22 bc 1 3 b 33 cd null Department(referenced/parent/primary/master) Dept id loc 1 del 2 kol 3 mumbai Super keys Emp id, Adharnumber Email id Emp id, adharnumber,emailid Adharno , email id Emp_id ,adharnumber Empid , name , departmentid Empid,name,adharno,emailed,deptid
  • 2. Purpose Key is used to uniquelyidentify any records or row of data from the table. It is used to establish and identify relationshipbetween table. Super key- A super key is a combinationof all possible attributes that can uniquelyidentifythe rows /tuples in the given relation. Super key is a superset of candidatekeys. A table can have multiple super keys. A SK may have additionalattributethat are not needed for uniqueidentity . All possible combinationsof attributes. Candidatekey- Candidatekey is a minimalsuperkey or a super key with no redundantattributes. It is called a minimal superkey because we select a candidate key from a set of super key such that selected candidatekey is the minimum attribute required to uniquelyidentify the table. Candidatekeys are defined as distinct set of attributes from which primary key can be selected. Candidatekeys are not allowedto have null values. Primary key – choose a key from candidatekey A primary key is one of the candidatekey chosen by database designer to uniquelyidentify the tuple in the relation.
  • 3. The value of pk can never be null The value of pk must alwaysbe unqiue. The values of pk can never be changed – no updationis possible The value of pk must be assigned when inserting a record A relation is allowed to have one primary key. Alternate key – out of all candidatekeys only one is selected as pk , remaining keys are called alternate keys Empid- primary key Name, adharno,email id, dept id- alternate keys. Foreign key – A key used to link two tables together An attribute / set of attribtes in one table that referes to pk in another table. The purpose – to ensure referential integrity of the data. Foreign key references the pk of the table. Fk can only take pk Fk can be null. There is no restriction that foreign key is unique. Composite key / compound key – a key that has more than one attribute . Cust_id Order_id Productcode Product
  • 4. count CO1 001 P111 5 CO2 012 P111 8 Co3 012 P222 6 Co1 001 P333 9 {Custid, productcode} One to many Relational Query Language – query language is the language in which user requests informationfrom databse. e.g sql – structured query language query – retrieval 2types of query languages Procedural query language –the user instructs the system to perform a series of operationsto produce the desired results. User tellswhat data to be retrieved from data base and how to retrieve. Non prodecural query language – (declarative) User instructs the system to produce the desired results without telling step by step process. User tellswhat data to be retrieved from data base but doesn’t tell how to retrieve it . Two pure(mathematical)query language
  • 5. Relationalgebra – procedural query language It is more operational Very useful for executionalplan. Relationalcalculus Non procedural query language It is non operational Tuple relationlcalculus Domain relationalcalculus Relationalmodel RDBMS RELATIONAL algebra,calculus sql algorithm code concept reality theoretical practical