Вы находитесь на странице: 1из 4

ERD Case Study

Draw an ER diagram that captures the preceding information.


i. PATIENTS are identified by an SSN, and their names, addresses, and ages must
be recorded.
ii. DOCTORS are identified by an SSN. For each doctor, the name, specialty, and
years of experience must be recorded.
iii. Each PHARMACEUTICAL company is identified by name and has a phone
number.
iv. For each DRUG, the trade name and formula must be recorded.
v. Each drug is sold by a given pharmaceutical company, and the trade name identifies
a drug uniquely from among the products of that company.
vi. Each PHARMACY has a name, address, and phone number.
vii. Every PATIENT has a Primary_Physician. Every doctor has at least one patient.
viii. Each PHARMACY sells several drugs and has a price for each. A drug could be
sold at several pharmacies, and the price could vary from one pharmacy to another.
ix. DOCTORS prescribe DRUGS for PATIENTS. A DOCTOR could prescribe one
or more DRUGS for several PATIENTS, and a patient could obtain prescriptions
from several doctors. Each prescription has a date and a quantity associated with
it.
x. PHARMACEUTICAL companies have long-term contracts with
PHARMACIES. A pharmaceutical company can contract with several pharmacies,
and a pharmacy can contract with several pharmaceutical companies. For each
contract, you have to store a Start_Date, an End_Date, and the text of the contract.
xi. Pharmacies appoint a supervisor for each contract. There must always be a
supervisor for each contract, but the contract supervisor can change over the lifetime
of the contract.
Case Study II

Organization has decided to store information about musicians who


perform on its albums (as well as other company data) in a database.

a. Each MUSICIAN that records has an SSN, a name, an address, and


a phone number.
b. Each INSTRUMENT used in songs recorded has a unique identification
number, a name (e.g., guitar, synthesizer, flute) and a musical key (e.g., C, B-flat,
E-flat).
Each ALBUM recorded on has a unique identification number, a title, a copyright date, a
format (e.g., CD or MC), and an album identifier.
c. Each SONG recorded has a title and an author.
d. Each MUSICIAN may play several INSTRUMENTS, and a given INSTRUMENT may
be played by several MUSICIANS.
e. Each ALBUM has a number of SONGS on it, but no SONG may appear on more than
one ALBUM.
f. Each SONG is performed by one or more MUSICIANS, and a MUSICIAN may perform
a number of SONGS.
g. Each ALBUM has exactly one MUSICIAN who acts as its producer. A musician may
produce several albums, of course.
Case Study III
A Laboratory has several CHEMISTS who work on one or more PROJECTS. CHEMISTS also
may use certain kinds of EQUIPMENT on each PROJECT. Attributes of CHEMIST include
Employee_ID (Identifier), Name and PhoneNo. Attributes of PROJECT include Project_ID
(Identifier), and Start_Date. Attributes of EQUIPMENT include Serial_No and Cost. The
organization wishes to record Assign_Date, that is, the date when a given piece of EQUIPMENT
was assigned to a particular CHEMIST on a particular PROJECT. A CHEMIST must be assigned
to at least one PROJECT and one equipment item. A given piece of equipment need not be
assigned, and a given project need not be assigned either a chemist or equipment item.
Case Study

i. Prepare an ERD for a real estate firm that lists property for sale. The following describes
the organization (NOTE: For most of the information given, it is up to you to determine
which are primary keys):
ii. The firm has a number of SALES_OFFICES in several states. Each office is identified
by a Office_Number and its location.
iii. Each SALES_OFFICE is assigned one or more EMPLOYEES. Attributes of
EMPLOYEE include Employee_ID and Employee_Name. An employee must be
assigned to only one SALES_OFFICE.
iv. For each sales office, there is always one employee assigned to manage that office. An
employee may manage only the sales office to which s/he is assigned.
v. The firm lists PROPERTY for sale. Some of the information they keep track of include
Property_ID and Location. Components of Location include Street, City, State, and
Zipcode.
vi. Each unit of Property must be listed with one (and only one) of the SALES_OFFICES.
A SALES_OFFICE may have any number of PROPERTIES listed, or may have no
PROPERTIES listed.
vii. Each unit of PROPERTY has one or more OWNERS, who are identified by Owner_ID
and Name. An OWNER may own one or more units of PROPERTY.

Вам также может понравиться