Data is accepted based
on certain rules & there fore data is valid.
Enforcing data integrity
ensures that the data in the database is valid and correct.
Keys play an important
role in maintaining data integrity.
The various types of
keys that have been identified are :
Candidate key
Primary key
Alternate key
Composite key
Foreign Key
Candidate key
An attribute or set of
attributes that uniquely identifies a row is called a Candidate key.
This attribute has
values that are unique
Vehicle
Primary Key
The Candidate key that you choose
to identify each row uniquely is called the Primary key.
Alternate Key
A Candidate key that is not
chosen as a Primary key is an Alternate key.
Composite Key
In certain tables, a single
attribute cannot be used to identify rows uniquely and a combination of two or
more attributes is used as a Primary key. Such keys are called Composite keys.
Purchase
Foreign Key
When a primary key of one table
appears as an attribute in another table, it is called the Foreign key in the
second table
A foreign key is used to relate
two tables.
Weak entity:
A weak entity does not have a
distinguishing attribute of its own and mostly are dependent entities, which
are part of some another entity.
A weak entity will always be
related to one or more strong entities.
They can be also understood as multi-valued
attributes.
0 comments