Database Reference
In-Depth Information
the many side of the relationship. Thus, in a 1:N relationship between DEPARTMENT and
EMPLOYEE, DEPARTMENT is the parent and EMPLOYEE is the child (one DEPARTMENT
has many EMPLOYEEs).
Figure 5-5(c) shows a many-to-many (abbreviated N:M) relationship . According to the
Qualification relationship, an EMPLOYEE instance can be associated with many SKILL instances,
and a SKILL instance can be associated with many EMPLOYEE instances. This relationship docu-
ments that fact that an employee may have many skills, and a skill may be held by many employees.
Sometimes students wonder why we do not write many-to-many relationships as N:N or
M:M. The reason is that cardinality in one direction may be different than the cardinality in the
other direction. In other words, in an N:M relationship, N need not equal M. An EMPLOYEE
can have five skills, for example, but one of those skills can have three employees. Writing the
relationship as N:M highlights the possibility that the cardinalities may be different.
Sometimes the maximum cardinality is an exact number. For example, for a sports team, the
number of players on the roster is limited to some fixed number, say, 15. In that case, the maximum
cardinality between TEAM and PLAYER would be set to 15 rather than to the more general N.
By ThE Way Relationships like those in Figure 5-5 are sometimes called haS-a
relationships. This term is used because each entity instance has a rela-
tionship to a second entity instance. An employee has a badge, and a badge has an
employee. If the maximum cardinality is greater than one, then each entity has a set
of other entities. An employee has a set of skills, for example, and a skill has a set of
employees who have that skill.
Minimum Cardinality
The minimum cardinality is the number of entity instances that must participate in a relation-
ship. Generally, minimums are stated as either zero or one. If zero, then participation in the
relationship is optional . If one, then at least one entity instance must participate in the rela-
tionship, which is called mandatory participation. In E-R diagrams, an optional relationship is
represented by a small circle on the relationship line; a mandatory relationship is represented
by a hash mark or line across the relationship line.
To better understand these terms, consider Figure 5-6. In the Employee_Identity relation-
ship in Figure 5-6(a), the hash marks indicate that an EMPLOYEE is required to have a BADGE,
and a BADGE must be allocated to an EMPLOYEE. Such a relationship is referred to as a man-
datory-to-mandatory (M-M) relationship because entities are required on both sides. The
complete specification for the Employee_Identity relationship is that it is a 1:1, M-M relationship.
(a) Mandatory-to-Mandatory (M-M) Relationship
Figure 5-6
Examples of Three Types
of Minimum Cardinality
EMPLOYEE
1:1
BADGE
Employee_Identity
(b) Optional-to-Optional (O-O) Relationship
EMPLOYEE
1:N
COMPUTER
Computer_Assignment
(c) Optional-to-Mandatory (O-M) Relationship
EMPLOYEE
N:M
SKILL
Qualification
 
Search WWH ::




Custom Search