Constraints in Database
• An Enterprise ER schema may define certain
constraints to which the contents of the database
must conform. There are two important
constraints. They are:
• 1. Mapping Constraints (Cardinality Ratio)
• 2. Participation Constraints
Prepared By: Yam Kumar Baral, JMC 1
Mapping Constraints
• Also known as Cardinality Ratio
• It expresses the number of entities of an entity set
that can be associated with how many entities of
another entity set through a relationship.
• It is most useful in describing the relationship sets
that involve more than two entity sets.
Prepared By: Yam Kumar Baral, JMC 2
Mapping Constraints
For a binary relationship set the mapping cardinality must be one of the
following types:
1. One to one (1:1)
2. One to many (1:N)
3. Many to one (M:1)
4. Many to many (M:N)
Prepared By: Yam Kumar Baral, JMC 3
One-to-One(1:1)
An entity in entity set A is
associated with at most one entity
in entity set B and an entity in B is
associated with at most one entity
in A. For example: the
relationship between Department
and Manager entity sets.
Prepared By: Yam Kumar Baral, JMC 4
One-to-Many(1:N)
In One-to-Many relationship, an entity
in entity set A is associated with any
number of entities (0 or more) in entity
set B. However, an entity in B is
associated with at most one entity in
A. For example: the relationship
between Department and Employee
entity sets.
Prepared By: Yam Kumar Baral, JMC 5
Many-to-One(M:1)
In Many-to-One relationship, an entity
in A is associated with at most one
entity in B. However, an entity in B
can be associated with any number
of entities (0 or more) in A. For
example: the relationship between
Employee and Manager entity sets.
Prepared By: Yam Kumar Baral, JMC 6
Many-to-Many(M:N)
In Many-to-Many relationship, an entity in
entity set A is associated with any number
of entities (0 or more) in entity set B and
an entity in B can be associated with any
number of entities (0 or more) in A. For
example: the relationship between
Employee and Project entity sets.
Prepared By: Yam Kumar Baral, JMC 7
Participation Constraints
• It specifies the participation of an entity set in a relationship set.
• There are two types participation constraints
1. Total participation
2. Partial participation
1. Total Participation − Each entity is involved in the relationship. Total participation is
represented by double lines.
2. Partial participation − Not all entities are involved in the relationship. Partial participation
is represented by single lines.
Prepared By: Yam Kumar Baral, JMC 8
Participation Constraints
Prepared By: Yam Kumar Baral, JMC 9
Participation Constraints
The participation of an entity set A in a relationship
set R is said to be total participation if every entity in
A participates at least one relationship in R. If only
some entity in A participates in relationship R then
the participation of entity set A on relationship set R
is called partial participation.
Prepared By: Yam Kumar Baral, JMC 10
STUDENT Issue BOOK
Total Participation Partial Participation
Prepared By: Yam Kumar Baral, JMC 11