Successfully reported this slideshow.
You’ve unlocked unlimited downloads on SlideShare!
Name: Sana Salah_ud_din
M.Sc CS (final)
Topic: Keys In Relational
AT A Glance:
What is :
A Key ?
A Super Key ?
A Candidate Key ?
A Primary Key ?
An Alternate Key ?
A KEY is an attribute or set
of attributes that uniquely
identifies a TUPLE in a relation.
There are two main types of key:
A Super Key
and a Foreign key
An attribute, or set of attributes, that uniquely
identifies a tuple within a relation.
A Super key may contain additional attributes that are
not necessary for unique identification.
A super key is the most
general type of key.
As shown in the figure the relat-
ion Branch has a super key
A key which is the candidate for being selected as a
A candidate key contains only the attributes which can
uniquely identify a tuple in a relation.
As shown in the figure --- in the
relation Branch the attributes
branchNo & postcode can serve
as candidate keys because both
can uniquely identify a tuple in
The candidate key that is selected to identify tuples
uniquely within the relation.
Some most important points about primary key are:
A relation can have only one primary key.
Each value in primary key attribute must be unique.
Primary key cannot contain null values.
As shown in the figure----
the attribute branchNo can
serve as primary key because
The candidate keys that are not selected as primary
key are known as alternate keys.
As shown in the figure
the relation Branch has
branchNo serving as pri-
mary key and postcode
serving as alternate key
because postcode can
A primary key that consists of two or more attributes is
known as COMPOSITE KEY.
As shown in the figu-
re– the relation Branch
has two attributes
serving as primary key
so this is a composite
An attribute, or set of attributes, within one relation
that matches the candidate key of some relation..
As shown in the figur-
e in the relation Staff
The attribute branchNo
is the foreign key
because it is the prim-
ary key in the relation