Page 251 - DCAP405_SOFTWARE_ENGINEERING
P. 251
Software Engineering
Notes 14.5 Cardinality and Modality
Constraints are domain rules that must be followed by the ER components for which they are
defined. A common constraint laid on relationship is that of cardinality.
Task Cardinality constraint specifies the multiplicity of instances of entities related to
each other by a relationship. Analyze
The relationship between entity sets may be many-to-many (M: N), one-to-many (1:M), many-
to-one (M: 1) or one-to-one (1:1). The 1:1 relationship between entity sets E1 and E2 indicates that
for each entity in either set there is at most one entity in the second set that is associated with it.
The 1:M relationship from entity set E1 to E2 indicates that for an occurrence of the entity from
the set E1, there could be zero, one, or more entities from the entity set E2 associated with it. Each
entity in E2 is associated with at most one entity in the entity set E1. In the M: N relationship
between entity sets E1 and E2, there is no restriction to the number of entities in one set associated
with an entity in the other set. The database structure, employing the E-R model is usually
shown pictorially using entity-relationship (E-R) diagram. The cardinality of a relation may be
represented by a set of pictorial notations called Crow Feet notation shown listed in table 14.2.
These symbols are paired to form desired cardinality.
Table 14.2: Crow feet notation
Crow Feet Notation Meaning
0 Zero
1 Exactly one
M Many
Paired Notation
Paired Symbol Meaning
0/1 Zeor or one
0/M Zero or one to zero or one
1/M Zero or one to exactly one
The “Crow’s Foot” notation represents relationships with connecting lines between entities,
and pairs of symbols at the ends of those lines to represent the cardinality of the relationship.
To illustrate these different types of relationships consider the following entity sets:
DEPARTMENT, MANAGER, EMPLOYEE, and PROJECT.
The relationship between a DEPARTMENT and a MANAGER is usually one-to-one; there is only
one manager per department and a manager manages only one department. This relationship
between entities is shown in Figure 14.7. Each entity is represented by a rectangle and the
relationship between them is indicated by a direct line. The relationship for MANAGER to
DEPARTMENT and from DEPARTMENT to MANAGER is both 1:1.
244 LOVELY PROFESSIONAL UNIVERSITY