Databases Reference
In-Depth Information
modality symbol) or one salesperson (the one or bar cardinality symbol). Start-
ing again at the SALESPERSON entity box and moving to the right, a salesper-
son has no customers or many customers. Remember that the customers are
hardware or home improvement stores. The CUSTOMER entity has three attrib-
utes and Customer Number is the unique identifier. In the reverse direction, a
customer must have exactly one salesperson.
From the CUSTOMER entity downward is the CUSTOMER EMPLOYEE
entity. According to the figure, a customer must have at least one but can have
many employees. An employee works for exactly one customer. This is actually
a special situation. General Hardware has an interest only in maintaining data
about the people who are its customers' employees as long as their employer
remains a customer of General Hardware. If a particular hardware store or home
improvement chain stops buying goods from General Hardware, then General
Hardware no longer cares about that store's or chain's employees. Furthermore,
while General Hardware assumes that each of its customers assigns their employ-
ees unique employee numbers, those numbers can only be assumed to be unique
within that customer store or chain. Thus the unique identifier for a customer
employee must be the combination of the Customer Number and the Employee
Number attributes. In this situation, CUSTOMER EMPLOYEE is called a depen-
dent entity. As shown in the CUSTOMER EMPLOYEE entity box in Figure 3-18,
a dependent entity is distinguished by a diagonal hash mark in each corner of
its attribute area.
Returning to the SALESPERSON entity box and looking downward, there is
a many-to-many relationship between salespersons and products. A salesperson
is authorized to sell at least one and possibly (probably, in this case) many prod-
ucts. A product is sold by at least one and possibly many salespersons. The
PRODUCT entity has three attributes, with Product Number being the unique
identifier. The attribute Quantity is intersection data in the many-to-many rela-
tionship, meaning that the company is interested in keeping track of how many
units of each product each salesperson has sold.
3.4.3 Good Reading Bookstores
Figure 3-19 shows the E-R diagram for Good Reading Bookstores, a chain of
bookstores that wants to keep track of the books it sells, their publishers, their
authors, and the customers who buy them. The topic entity has four attrib-
utes; Book Number is the unique identifier. A topic has exactly one publisher.
Publisher Name is the unique identifier of the PUBLISHER entity. A publisher
may have (and generally has) published many books that Good Reading carries;
however, Good Reading also wants to be able to keep track of some publishers
that currently have no books in Good Reading's inventory. (Note the zero modal-
ity symbol from PUBLISHER towards BOOK.) A book must have at least one
author but can have many (where in this case “many” means a few, generally
Search WWH ::




Custom Search