Академический Документы
Профессиональный Документы
Культура Документы
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.