Вы находитесь на странице: 1из 14

Entity set Attribute Value

EMPLOYEE EMPLOYEE.Name George hall


EMPLOYEE.Soc_Se 787394510
c_No
EMPLOYEE.Addres 110Woolsey dr.
s
EMPLOYEE.Skill Cook
EMPLOYEE.Annual 42650.00
_salary
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:
 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
set.
 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.
Customer_
SSN street

Customer
_Name Customer_city

Customer
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:
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.
PRIMARY KEY:
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
attributes.
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
entity.
 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.
FOREIGN KEY:
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.
SECONDARY KEY:
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
key.
THANK YOU.

Вам также может понравиться