0% found this document useful (0 votes)
122 views

Solution 1

The document provides details for two homework assignments involving designing ER diagrams for databases. The first assignment involves designing a database for an airport, including entities like airplanes, technicians, tests, and test results. The second assignment involves a database for a pharmacy including entities like patients, doctors, drugs, prescriptions, and contracts between pharmacies and drug companies. For each assignment, the student is asked to provide the ER diagram and identify any constraints not shown in the diagram. They are also asked how the design would change under alternative scenarios.

Uploaded by

Amruta Mahajan
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
122 views

Solution 1

The document provides details for two homework assignments involving designing ER diagrams for databases. The first assignment involves designing a database for an airport, including entities like airplanes, technicians, tests, and test results. The second assignment involves a database for a pharmacy including entities like patients, doctors, drugs, prescriptions, and contracts between pharmacies and drug companies. For each assignment, the student is asked to provide the ER diagram and identify any constraints not shown in the diagram. They are also asked how the design would change under alternative scenarios.

Uploaded by

Amruta Mahajan
Copyright
© © All Rights Reserved
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

Database Systems

Instructor: Hao-Hua Chu


Fall Semester, 2007

Homework 1: ER Diagram

Questions

1. (Textbook Q2.6) Computer Sciences Department frequent flies have been complaining to
Dane County Airport officials about the poor organization at the airport. As a result, the
officials decided that all information related to the airport should be organized using a
DBMS, and you have been hired to design the database. Your first task is to organize the
information about all the airplanes stationed and maintained at the airport. The relevant
information is as follows:
□ Every airplane has a registration number, and each airplane is of a specific model.
□ The airport accommodates a number of airplane models, and each model is identified by a
model number (e.g., DC-10) and has a capacity and a weight.
□ A number of technicians work at the airport. You need to store the name, SSN, address,
phone number, and salary of each technician.
□ Each technician is an expert on one or more plane models(s), and his or her expertise may
overlap with that of other technicians. This information about technicians must also be
recorded.
□ Traffic controllers must have an annual medical examination. For each traffic controller, you
must store the date of the most recent exam.
□ All airport employees (including technicians) belong to a union. You must store the union
membership number of each employee. You can assume that each employee is uniquely
identified by a social security number.
□ The airport has a number of tests that are used periodically to ensure that airplanes are still
airworthy. Each test has a Federal Aviation Administration (FAA) test number, a name, and a
maximum possible score.
□ The FAA requires the airport to keep track of each time a given airplane is tested by a given
technician using a given test. For each testing event, the information needed is the date, the
number of hours the technician spent doing the test, and the score the airplane received on
the test.

1. Draw an ER diagram for the airport database. Be sure to indicate the various attributes
of each entity and relationship set; also specify the key and participation constraints for
each relationship set. Specify any necessary overlap and covering constraints as well (in
English).
2. The FAA passes a regulation that tests on a plane must be conducted by a technician
who is an expert on that model. How would you express this constraint in the ER
diagram? If you cannot express it, explain briefly.

Reference answer:

ER diagram

1. Since all airline employees belong to a union, there is a covering constraint on the Employees ISA
hierarchy.
2. You cannot note the expert technician constraint the FAA requires in an ER diagram. There is no
notation for equivalence in an ER diagram and this is what is needed: the Expert relation must be
equivalent to the Type relation.

2. (Textbook Q2.7) The Prescriptions-R-X chain of pharmacies has offered to give you a free
life-time supply of medicine if you design its database. Given the rising cost of health care,
you agree. Here’s the information that you gather:
□ Patients are identified by an SSN, and their names, addresses, and ages must be recorded.
□ Doctors are identified by an SSN. For each doctor, the name, specialty, and years of
experience must be recorded.
□ Each pharmaceutical company is identified by name and has a phone number.
□ For each drug, the trade name and formula must be recorded. Each drug is sold by a given
pharmaceutical company, and the trade name identifies a drug uniquely from among the
products of that company. If a pharmaceutical company is deleted, you need not keep track
of its products any longer.
□ Each pharmacy has a name, address, and phone number.
□ Every patient has a primary physician. Every doctor has at least one patient.
□ 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.
□ 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. You can assume that, if a doctor prescribes the same
drug for the same patient more than once, only the last such prescription needs to be stored.
□ 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.
□ 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.

1. Draw an ER diagram that captures the preceding information. Identify any constraints
not captured by the ER diagram.
2. How would your design change if each drug must be sold at a fixed price by all
pharmacies?
3. How would your design change if the design requirements change as follows: If a doctor
prescribes the same drug for the same patient more than once, several such prescriptions
may have to be stored.

Reference answer:

ER diagram:
2. If the drug is to be sold at a fixed price we can add the price attribute to the Drug entity set and
eliminate the price from the Sell relationship set.
3. The date information can no longer be modeled as an attribute of Prescription. We have to create a
new entity set called Prescription date and make Prescription a 4-way relationship set that
involves this additional entity set.

You might also like