Database Reference
In-Depth Information
FISHING_LICENSE
LicenseNo
Name
Address
City
State
Zip
VESSEL
COMMERCIAL_LICENSE
SPORT_LICENSE
VesselNumber
Figure 5-37
Data Model for Form in
Figure 5-36
VesselName
VesselType
TaxID
NumberYearsAtAddress
PriorYearLicenseNumber
Recursive Patterns
A recursive relationship , also called a unary relationship , occurs when an entity type has a
relationship to itself. The classic examples of recursive relationships occur in manufacturing
applications, but there are many other examples as well. As with strong entities, three types of
recursive relationships are possible: 1:1, 1:N, and N:M. Let's consider each.
1:1 Recursive Relationships
Suppose you are asked to construct a database for a railroad, and you need to make a model of
a freight train. You know that one of the entities is BOXCAR, but how are BOXCARs related? To
answer that question, envision a train. Except for the first boxcar, each has one boxcar in front,
and, except for the last boxcar, each boxcar has one boxcar in back. Thus, the relationship is
1:1 between boxcars, with an optional relationship for the first and last cars.
Figure 5-38 shows a data model in which each BOXCAR has a 1:1 relationship to the
BOXCAR ahead. The BOXCAR entity at the head of the train has a 1:1 relationship to ENGINE.
(This model assumes a train has just one engine. To model trains with multiple engines, cre-
ate a second recursive relationship among engines. Construct that relationship just like the
Boxcar Ahead relationship.)
ENGINE
Figure 5-38
Data Model for a 1:1
Recursive Relationship
EngineNumber
Type
HorsePower
First Boxcar
BOXCAR
BoxCarNumber
Capacity
Type
Boxcar Ahead
 
Search WWH ::




Custom Search