University of the People
CS 2203 – Database 1.
Dr. Vasha Himthani
Programming Assignment Unit 4.
The assignment must define or describe the changes required to get the relations into the 1st
normal form.
For a relation to be in the first normal form, it has to meet the following rules.
1. The relation must have domains that are indivisible (Sharma et al 2010)
2. Column to contain values of the same domain.
3. No duplicate rows.
4. Each column to have unique name.
5. No ordering of rows and column.
The doctor Relation in 1NF
Doctor Relation
Doctor ID Name Phone SpecialtyNumber Speciality Supervisor
Appointment Relation in 1NF
Appointment Relation.
AppointmentID DoctorID PatientD AppointmentDate BloodPressure Weight TreatmentNote
Medicine Relation
MedicineID medicines
Patient Relation in 1NF
Patient Relation.
PatientID Name Phone Email Address AddedDate DoctorID
Allergies Relation
AllergeyID Allergies
The assignment must define or describe the changes required to get the relations into the
2nd normal form.
For a relation to be in the 2NF, it must meet the following rules.
1. The relation must be in the 1NF
2. There should be no partial dependency in the relation.
The doctor Relation in 2NF
Doctor Relation
Doctor ID Name Phone SpecialtyNumber Specialty Supervisor
Specialty Relation
DoctorID SpecialtyNumber Specialty
The appointment relation and the patient relation as they are shown the 1NF above meet the
rules of 2NF.
The assignment should include an Entity Relationship diagram in 3rd normal form.
For the relation to be in 3NF, Sharma et al (2010) argues that it should meet following rules.
1. The relation must be in the 2NF
2. There is no non-key attribute that depends transitively on the candidate key.
3. Every attribute depends on primary key and it should not depend transitively on primary
key
Entity Relationship diagram that details the relationships between Relations.
In the diagram below, the primary key are the DOCTORID, PATIENTID, APPOINTMENTID,
ALLERGYID, MEDICINEID and SPECIALITY_NO
The description of the E-R diagram
The relationship between the specialty and doctor relation is one to one. Meaning one doctor
has one specialty.
The relationship between doctor to patient is one to many.
The relationship between allergy and patient is zero, one or many to one.
The relationship between patient and appointment is one to many.
The relationship between doctor and appointment is one to many.
And finally the relationship between medicine and appointment is zero, one or many to one.
Reference.
Sharma, N., Perniu, L., Chong, R. F., Iyer, A., Nandan, C., Mitea, A. C., Nonvinkere, M., &
Danubianu, M. (2010). Databases fundamentals. Download the pdf.