Programming Assignment Unit 4
Programming Assignment Unit 4
Programming Assignment Unit 4
CS 2203 – Database 1.
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
Medicine Relation
MedicineID medicines
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
Specialty Relation
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
In the diagram below, the primary key are the DOCTORID, PATIENTID, APPOINTMENTID,
ALLERGYID, MEDICINEID and SPECIALITY_NO
The relationship between the specialty and doctor relation is one to one. Meaning one doctor
has one specialty.
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.