Database Reference
In-Depth Information
about primary and foreign keys, referential integrity constraints, and the like. Most data
modeling products will allow you to consider such details if you choose to, but they do
not require it.
This characteristic makes entities easier to work with than tables, especially early
in a project when entities and relationships are fluid and uncertain. You can show rela-
tionships between entities before you even know what the identifiers are. For example,
you can say that a DEPARTMENT relates to many EMPLOYEEs before you know any of
the attributes of either EMPLOYEE or DEPARTMENT. This characteristic enables you to
work from the general to the specific. First, identify the entities, then think about rela-
tionships, and, finally, determine the attributes.
In the entity-relationship model, relationships are classified by their cardinality , a word
that means “count.” The maximum cardinality is the maximum number of entity instances
that can participate in a relationship instance. The minimum cardinality is the minimum
number of entity instances that must participate in a relationship instance.
Maximum Cardinality
In Figure 5-5, the maximum cardinality is shown inside the diamond that represents the relation-
ship. The three parts of this figure show the three basic maximum cardinalities in the E-R model.
Figure 5-5(a) shows a one-to-one (abbreviated 1:1) relationship . In a 1:1 relationship,
an entity instance of one type is related to at most one entity instance of the other type. The
Employee_Identity relationship in Figure 5-5(a) associates one EMPLOYEE instance with one
BADGE instance. According to this diagram, no employee has more than one badge, and no
badge is assigned to more than one employee.
The Computer_Assignment relationship in Figure 5-5(b) illustrates a one-to-many
(abbreviated 1:N) relationship . Here a single instance of EMPLOYEE can be associated
with many instances of COMPUTER, but a COMPUTER instance is associated with just
one instance of EMPLOYEE. According to this diagram, an employee can be associated with
several computers, but a computer is assigned to just one employee.
The positions of the 1 and the N are significant. The 1 is close to the line connecting
EMPLOYEE, which means that the 1 refers to the EMPLOYEE side of the relationship. The N is close
to the line connecting COMPUTER, which means that the N refers to the COMPUTER side of the
relationship. If the 1 and the N were reversed and the relationship were written N:1, an EMPLOYEE
would have one COMPUTER, and a COMPUTER would be assigned to many EMPLOYEEs.
When discussing one-to-many relationships, the terms parent and child are sometimes
used. The parent is the entity on the 1 side of the relationship, and the child is the entity on
(a) One-to-One Relationship
Figure 5-5
Three Types of Maximum
Cardinality
EMPLOYEE
1:1
BADGE
Employee_Identity
(b) One-to-Many Relationship
EMPLOYEE
1:N
COMPUTER
Computer_Assignment
(c) Many-to-Many Relationship
EMPLOYEE
N:M
SKILL
Qualification
 
Search WWH ::




Custom Search