Databases Reference
In-Depth Information
in this statement is the one just to the left of the office entity box. Conversely,
reading from right to left, ''An office is occupied by one salesperson.''
One-to-Many Binary Relationship Associations can also be multiple in nature.
Figure 2.3b shows a one-to-many (1-M) binary relationship between salespersons
and customers. The ''crow's foot'' device attached to the customer entity box
represents the multiple association. Reading from left to right, the diagram indicates
that a salesperson sells to many customers. (Note that ''many,'' as the maximum
number of occurrences that can be involved, means a number that can be 1, 2, 3, … n .
It also means that the number is not restricted to being exactly one, which would
require the ''one'' or ''bar'' symbol instead of the crow's foot.) Reading from
right to left, Figure 2.3b says that a customer buys from only one salesperson. This
is reasonable, indicating that in this company each salesperson has an exclusive
territory and thus each customer can be sold to by only one salesperson from the
company.
Many-to-Many Binary Relationship Figure 2.3c shows a many-to-many (M-M)
binary relationship among salespersons and products. A salesperson is authorized
to sell many products; a product can be sold by many salespersons. By the way,
in some circumstances, in either the 1-M or M-M case, ''many'' can be either an
exact number or have a known maximum value. For example, a company rule may
set a limit of a maximum of ten customers in a sales territory. Then the ''many'' in
the 1-M relationship of Figure 2.3b can never be more than 10 (a salesperson can
have many customers but not more than 10). Sometimes people include this exact
number or maximum next to or even instead of the crow's foot in the E-R diagram.
Modality
Figure 2.4 shows the addition of the modality ,the minimum number of entity
occurrences that can be involved in a relationship. In our particular salesperson
environment, every salesperson must be assigned to an office. On the other hand, a
given office might be empty or it might be in use by exactly one salesperson. This
situation is recorded in Figure 2.4a, where the ''inner'' symbol, which can be a zero
or a one, represents the modality—the minimum—and the ''outer'' symbol, which
can be a one or a crow's foot, represents the cardinality—the maximum. Reading
Figure 2.4a from left to right tells us that a salesperson works in a minimum of one
and a maximum of one office, which is another way of saying exactly one office.
Reading from right to left, an office may be occupied by or assigned to a minimum
of no salespersons (i.e. the office is empty) or a maximum of one salesperson.
Similarly, Figure 2.4b indicates that a salesperson may have no customers
or many customers. How could a salesperson have no customers? (What are we
paying her for?!?) Actually, this allows for the case in which we have just hired
a new salesperson and have not as yet assigned her a territory or any customers.
On the other hand, a customer is always assigned to exactly one salesperson. We
never want customers to be without a salesperson—how would they buy anything
from us when they need to? We never want to be in a position of losing sales! If
a salesperson leaves the company, the company's procedures require that another
salesperson or, temporarily, a sales manager be immediately assigned the departing
salesperson's customers. Figure 2.4c says that each salesperson is authorized to sell
at least one or many of our products and each product can be sold by at least one
Search WWH ::




Custom Search