You are on page 1of 7

Database System

Nasreen akhtar
FAST-NU
Chiniot-Faisalabad campus
Lecture 4

 Relational Data Model.


 Relational Database Constraints.
 Relational Data Model Constraints.
 Relational Data base Schema
Relational Integrity Constraints
 Constraints: conditions that must hold on all valid relation
states.
 Integrity: Overall completeness, accuracy and consistency of
data.
 There are Four main types of constraints in the relational
model:
 Domain constraint
 Entity integrity constraints
 Referential integrity constraints
 Key constraints
Relational Integrity Constraints
 Domain Constraint
 Every value in a tuple must be from the domain of its attribute (or it could be
null, if allowed for that attribute)
 The value of an attribute is limited to its domain.
 A domain can impose rules on both formats and valid value ranges.
 A salary value cannot be negative
 2006-02-15 is an incorrect address.
 2006-02-29 is an incorrect date.
 Something must be wrong with a present employee born in 1800-01-01.
 An employee’s name cannot be NULL.
 This is called the NOT NULL constraint.
Relational Integrity Constraints
 Entity integrity Constraint:
The entity integrity constraint states that primary keys can't be null.
There must be a proper value in the primary key field.
This is because the primary key value is used to identify individual rows in a table.

 Referential Integrity Constraint:


 A referential integrity constraint is defined as part of an association between two
entity types
 If a foreign key exists in a relation, then it must match with primary key value in
some relation.

 Key Constraints:
Specify that any tuple should not repeated in same relation
Displaying a relational database schema
and its constraints
 Each relation schema can be displayed as a row of attribute
names
 The name of the relation is written above the attribute
names
 The primary key attribute (or attributes) will be underlined
 A foreign key (referential integrity) constraints is displayed
as a directed arc (arrow) from the foreign key attributes to
the referenced table
 Can also point the primary key of the referenced relation for
clarity

You might also like