Databases Reference
In-Depth Information
Figure 3-16
Sale
SALESPERSON
PRODUCT
*
*
Salesperson
Number
Salesperson
Name
Commission
Percentage
Year of Hire
Product
Number
Product
Name
Unit Price
Quantity
Associative entity.
relationship occurrence further describing the relationship. We know not only
that salesperson 137 sold some of product 24013 but also how many units of
that product that salesperson sold.
Using Associative Entities
Since we know that entities can have attributes and now we see that many-
to-many relationships can have attributes, does that mean that entities and
many-to-many relationships can in some sense be treated in the same way
within E-R diagrams? Indeed they can, although it is a matter of choice and
not a requirement! Figure 3-16 shows the many-to-many relationship Sells
converted into the associative entity Sale. An occurrence of the Sale associa-
tive entity does exactly what the many-to-many relationship did: it indicates
a relationship between a salesperson and a product, specifically sales, and
includes any intersection data that describes that relationship. Note very, very
carefully the reversal of the cardinalities and modalities when the many-to-
many relationship is converted to an associative entity. Sale is now a kind of
entity in its own right, and you must think of the new relationships as fol-
lows. A salesperson can be involved in many sales (where in this case sale
means that a salesperson has been involved in selling a type of product over
some period of time), but a particular sale can only involve one salesperson!
Similarly, a product can be involved in many sales, but a particular sale can
involve only one product.
If the many-to-many relationship E-R diagram style of Figure 3-15 is
equivalent to the associative entity style of Figure 3-16, which one should you
use? This is one of those instances in which this type of diagramming is an
art with a lot of leeway for personal taste. The fact is that you can use either
one, but you may find yourself working for a company that has set standards
for these diagrams and expects you to use the one that has been chosen for
its standards.
Search WWH ::




Custom Search