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

DOCX
Doc 20191022-wa0041
PPTX
Dbms keysppt
PPTX
V35 keys-c
PPTX
Dbms keys
PPTX
Presentation OF DBMS-2.pptx
PPTX
Types of keys dbms
PPTX
Keys_in_DBMS_VALID_INFORMATION_IS_AVAILA
PPTX
Types of keys in database | SQL
Doc 20191022-wa0041
Dbms keysppt
V35 keys-c
Dbms keys
Presentation OF DBMS-2.pptx
Types of keys dbms
Keys_in_DBMS_VALID_INFORMATION_IS_AVAILA
Types of keys in database | SQL

Similar to DATA BASE KEYS.docx (20)

PPTX
DBMS key topic Presentation slide 1.pptx
PPTX
Keys.pptx
PPTX
Types Of Keys in DBMS
PDF
computer-210809080138.pdf
PPTX
Keys in SQL.........................pptx
PPTX
Copy of Templates ............. (1).pptx
PPTX
Copy of Templates & Apps............................. (1).pptx
PPTX
DBMS Keys.pptx
PPTX
Types of keys
PPTX
SQL_DBMS_KEYS.pptx
PPTX
Database keys
PPTX
PDF
DBMS_Keys.pdf
DOCX
Keys used in database
PPTX
What are Database keys in Database System
PPTX
What are Database Keys in Database System
PDF
Keys in Database
PPTX
Key in DatabaseManagementSystem_engineering.pptx
PPTX
Keys and its Importance in DBMS and RDBMS
PPTX
The Relational Database Model
DBMS key topic Presentation slide 1.pptx
Keys.pptx
Types Of Keys in DBMS
computer-210809080138.pdf
Keys in SQL.........................pptx
Copy of Templates ............. (1).pptx
Copy of Templates & Apps............................. (1).pptx
DBMS Keys.pptx
Types of keys
SQL_DBMS_KEYS.pptx
Database keys
DBMS_Keys.pdf
Keys used in database
What are Database keys in Database System
What are Database Keys in Database System
Keys in Database
Key in DatabaseManagementSystem_engineering.pptx
Keys and its Importance in DBMS and RDBMS
The Relational Database Model
Ad

Recently uploaded (20)

PPTX
master seminar digital applications in india
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PDF
Anesthesia in Laparoscopic Surgery in India
PDF
STATICS OF THE RIGID BODIES Hibbelers.pdf
PDF
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
Module 4: Burden of Disease Tutorial Slides S2 2025
PDF
01-Introduction-to-Information-Management.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Microbial disease of the cardiovascular and lymphatic systems
PPTX
Cell Types and Its function , kingdom of life
PDF
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
PPTX
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
PDF
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
PDF
Classroom Observation Tools for Teachers
PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PDF
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
PDF
A systematic review of self-coping strategies used by university students to ...
master seminar digital applications in india
Supply Chain Operations Speaking Notes -ICLT Program
Anesthesia in Laparoscopic Surgery in India
STATICS OF THE RIGID BODIES Hibbelers.pdf
grade 11-chemistry_fetena_net_5883.pdf teacher guide for all student
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
Module 4: Burden of Disease Tutorial Slides S2 2025
01-Introduction-to-Information-Management.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Microbial disease of the cardiovascular and lymphatic systems
Cell Types and Its function , kingdom of life
Black Hat USA 2025 - Micro ICS Summit - ICS/OT Threat Landscape
1st Inaugural Professorial Lecture held on 19th February 2020 (Governance and...
A GUIDE TO GENETICS FOR UNDERGRADUATE MEDICAL STUDENTS
Classroom Observation Tools for Teachers
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
Final Presentation General Medicine 03-08-2024.pptx
GENETICS IN BIOLOGY IN SECONDARY LEVEL FORM 3
A systematic review of self-coping strategies used by university students to ...
Ad

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