Databases Reference
In-Depth Information
products. Going in the reverse direction, a product can be composed of no other
products or be composed of several other products.
TERNARY RELATIONSHIPS
A ternary relationship involves three different entity types. Assume for the
moment that any salesperson can sell to any customer. Then, Figure 2.8 shows
the most general, many-to-many-to-many ternary relationship among salespersons,
customers, and products. It means that we know which salesperson sold which
product to which customer. Each sale has intersection data consisting of the date of
the sale and the number of units of the product sold.
EXAMPLE: THE GENERAL HARDWARE COMPANY
Figure 2.9 is the E-R diagram for the General Hardware Company, parts of which
we have been using throughout this chapter. General Hardware is a wholesaler
and distributor of various manufacturers' tools and other hardware products. Its
customers are hardware and home improvement stores, which in turn sell the
products at retail to individual consumers. Again, as a middleman it buys its goods
from the manufacturers and then sells them to the retail stores. How exactly does
CUSTOMER
PK
One
Customer
Customer
Number
Customer
Name
HQ City
Many
Customers
Purchased
Sold to
One
Salesperson
One
Product
SALESPERSON
PK
SALE
PRODUCT
Salesperson
Number
Salesperson
Name
Commission
Percentage
Year of Hire
PK
Salesperson
Number
PK
Product
Number
Product
Name
Unit Price
Sold
Sold by
Sold
Sold
Product
PK
Product
Number
PK
Customer
Number
Date
Quantity
Many
Salespersons
Many
Products
FIGURE2.8
Ternary relationship
Search WWH ::




Custom Search