Database Reference
In-Depth Information
Primary keys are
underlined
Street
CustomerName
FirstName
Street
City
219
LastName
City
CustomerNum
RepNum
State
1
n
Rep
Represents
Customer
State
CreditLimit
Zip
Rate
Balance
Zip
Commission
Attributes are
shown as ovals
FIGURE 6-37
One-to-many relationship with attributes added
In the original version of the E-R model, attributes and relationships can have attributes. Figure 6-38
shows the many-to-many relationship between the Orders and Part entities, in which the relationship,
OrderLine, has two attributes, NumOrdered and QuotedPrice.
OrderDate
Description
PartNum
OrderNum
OnHand
m
n
Orders
OrderLine
Part
Class
Warehouse
NumOrdered
QuotedPrice
Price
Attributes for
OrderLine
FIGURE 6-38
Many-to-many relationship with attributes
In Figure 6-38, it is not clear whether OrderLine is an entity or a relationship. To address this confusion,
the E-R model was changed slightly so that entities can have attributes but relationships cannot. With this
change, OrderLine in Figure 6-38 would be an entity. However, making OrderLine an entity does not effec-
tively communicate the fact that the OrderLine entity is implementing only a many-to-many relationship
between orders and parts. To address this problem, an entity that exists to implement a many-to-many rela-
tionship is called a composite entity. A composite entity is essentially both an entity and a relationship and is
represented in an E-R diagram by a diamond within a rectangle. Figure 6-39 shows this new approach.
Search WWH ::




Custom Search