DB Design
DB Design
General introduction
A hospital consists of a number of specialized clinics (such as Maternity, Pediatrics, Cardiology, etc). Each
clinic has a number of doctors who work in it. Doctors are specialists in some branch of medicine and
can be associated with at most one clinic of the hospital. Each clinic hosts a number of patients. On
admission, the personal details of every patient are recorded. We also want to store information about
medical tests undertaken by a patient, after recommendation of a specialist. A number of tests may be
conducted for each patient. In addition, we would like to keep the following information:
For each clinic, a name that uniquely identify it and the total number of rooms in the clinic. A
clinic can have more than one doctor who works in it, can have more than one patient, and is
managed by exactly one doctor.
For each doctor, a license id which uniquely identifies him or her, the first and last name, the
telephone number(s) (there can be more than one), the office, and the specialty. A doctor works
in only one clinic. We want to keep, as well, the date when the doctor started working in the
clinic.
For each patient, a SIN (social insurance number) which uniquely identifies a patient, the first
and last name, and the sex. A patient can undertake many medical tests and a medical test can
be undertaken by many patients. For each patient hosted in a clinic, we want to keep, as well,
the date when the patient arrived at the clinic and the date when they left the clinic.
For each medical test, a test code that uniquely identifies it, a description, a cost, and the result
of the test for each patient. The result of a test can be either negative or positive.
Part A
Design an Entity-Relationship Model (ER Diagram) for the hospital. Use entities (rectangles),
relationships (diamonds) and attributes (ovals) to model the information above. Clearly indicate primary
keys (underlined attributes) and the cardinalities with which an entity participates in a relationship
(express the participation of an entity to a relationship with a pair of (minimum, maximum) or
alternatively, you can use the arrow notation of the textbook).
Part B
Translate your Entity-Relationship Model (ER Diagram) from the question above into a logical model (DB
Schema). For each relation in your schema, provide its name, attributes and keys (underlined attributes).
Part A
Part B
Doctor (doctorId, dfname, dlname, office, specialty, worksin, manages, start_date)
Tel(doctorId, tel)