Databases Reference
In-Depth Information
Figure 3-10
SALESPERSON
PRODUCT
*
Salesperson
Number
Salesperson
Name
Commission
Percentage
Year of Hire
*
Product
Number
Product
Name
Unit Price
Sells
Many
Products
Many
Salespersons
A sample binary relationship.
customer accounts and normally sell to those accounts only. Each customer also
has a backup salesperson who handles the customer's needs if its primary sales-
person is unavailable.
3.3.1 Binary Relationships
The simplest kind of relationship is known as the binary relationship—a rela-
tionship between two entity types. Figure 3-10 shows a small E-R diagram with
a binary relationship between two entity types: salespersons and products. The
diamond-shaped box represents the relationship.
The E-R diagram in Figure 3-10 tells us that a salesperson “sells” products.
Conversely, products are sold by salespersons. That's good information, but we
can do better than that with a very small increase in effort. Just knowing that a
salesperson sells products leaves open several obvious and important questions.
Is a particular salesperson allowed to sell only one kind of product, or two, or
three, or all of the available products? Can a particular product be sold by only
a single salesperson or by all of the salespersons? Might we want to keep track
of a new salesperson who has just joined the company but has not been assigned
to sell any products yet (assuming that there is indeed a restriction on which
salespersons can sell which products)?
Figure 3-11 shows three binary relationships of different cardinalities,
which is the maximum number of entities that can be involved in a particular
relationship. Figure 3-11a shows a one-to-one (1-1) binary relationship, which
means that a single occurrence of one entity type can be associated with a sin-
gle occurrence of the other entity type and vice versa. A particular salesperson
is assigned to one office. Conversely, a particular office (they are all private
offices) has just one salesperson assigned to it. Note the “bar” or “one” symbol
on either end of the relationship in the diagram indicating the maximum one
cardinality. The way to read these diagrams is to start at one entity, read the rela-
tionship in the diamond, pick up the cardinality on the other side of the diamond
 
 
Search WWH ::




Custom Search