Sie sind auf Seite 1von 14

Entity set Attribute Value


EMPLOYEE.Soc_Se 787394510
EMPLOYEE.Addres 110Woolsey dr.
EMPLOYEE.Annual 42650.00
The attribute EMPLOYEE.Soc_Sec_no uniquely
indentifies an instances of the entity set EMPLOYEE.
The value 787394510 for the attribute
EMPLOYEE.Soc_Sec_no uniquely identifies the
employee george hall. A key would not be unique if an
attribute such as EMPLOYEE.Skill were used. Such
attributes identify more than one instance of the entity
set EMPLOYEE. The value of the cook for the
EMPLOYEE.Skill indentifies all employees with this skill
DBMS has five types of keys in it and they all
have different functionality.
Types of keys:
Super key
Candidate key
Primary key
Foreign key
Alternate keys
Secondary keys
 Super key is a set of attributes whose set of
values can uniquely identify an entity
instance in the entity set.
 A super key can contain one or more than
one attribute.
 A super key is the brodest defination of
unique identifiers of an entity in an entity
 Super key may have redundant attributes.
The combination of “SSN” and “Name” is a super
key of the following entity set customer.
Because :
The value of attributes “SSN” and “Name”, such
as 558-36-1234 and susan, can uniquely identify
that particular customer in the customer set,
which is the pool of all customers.
SSN street

_Name Customer_city

We are unsuprisingly very intersted in the
most economical combination(s) of
attributes that can uniquely identify any
particular entity. Therefore, we introduce
candidate key next.
Candidate key is a set of one or more
attributes whose set of values can
uniquely identify an entity instance in the
entity set.
Any attribute in the candidate key can not
be omitted without destroying the
uniqueness property of the candidate key.
It is minimal super key.
 While most entity sets have only one
candidate key, some entity set could have
more than one candidate key.
 In building a database in a database software,
the software will only allow to use one
candidate keys to be the unique identifier of
an entity for an entity set.
 Example: AadharID , StudentID are eligible of
becoming candidate key of the entity student
as they uniquely identify the data.
The primary is an attribute or a set of
attributes that uniquely identifuies a
specific instance of an entity.
Every entity of the data model must have
a primary key whose values uniquely
identifies instances of the entity.
Every primary key is the super key.
Primary key do not have redundant
To qualify as a primary key for an entity, an
attributes must have these following properties:
 Itmust have a non-null value for each instance of
the entity.
 The value must be unique for each instance of an
 The values must not change or become null during
the life of each entity instance.
 Primary and foreign keys are the most basic
components on which relational theory are based.
Each entity must have a attribute or attributes, the
primary key, whose values uniquely identify each
instance of the entity. Every child entity must have
an attribute, the foreign key, that completes the
association with the parent entity.
A foreign key is an attribute that completes a
relationship by identifying the parent entity.
 Foreign keys constraints also prevents invalid data
from being inserted into the foreign key column,
because it has to be one of the values contained
in the table it points to.
 Every relationship in the model must be
supported by a foreign key.
 A foreign key is a field in one table that refers to
the primary key of another table.
 The table containing the foreign key is called the
child table, and the table containing the candidate
key is called the parent table.
An entity may have one or more choises
for the primary key. Collectively these are
known as candidate keys. One is selected as
the primary key and those which are not
selected are known as secondary keys. The
table can have more than one secondary