Exercises Normalization
Exercises Normalization
(a) The table shown in Figure 1 is susceptible to update anomalies. Provide examples of
insertion,deletion, and modification anomalies.
Answers:
This table is not well structured, un-normalized containing redundant data. By using a bottom-
up approach we analyzing the given table for anomalies. First observation, we see multiple
values in an appointment column and this of course violate the 1NF. By assuming the staffNo
and patientNo as candidate keys, there are many anomalies exist.
Insertion anomalies:
To insert a new patient particular that makes an appointment with the designated Doctor, we
need to enter the correct detail for the staff. For example, to insert the details of new patient
in patientNo, patientName and an appointment, we must enter the correct details of the
doctor (staffNo,dentistName) so that the patient details are consistent with values for the
designated Doctor for example, S1011.
To enter new patient data that doesn’t have Doctor to be assigned we can’t insert NULL values
for the primary key.
Deletion anomalies:
If we want to delete a patient named Ian MacKay for example, two records need to be deleted
as in row 3 and 4. This anomaly also obvious when we want to delete the dentistName,
multiple records needs to be deleted to maintain the data integrity.
When we delete a Dentist record, for example Tony Smith, the details about his patients also
lost from the database.
Modification anomalies:
With redundant data, when we want to change the value of one columns of a particular
Dentist, for example the dentistName, we must update all the Dentist records that assigned to
the particular patient otherwise the database will become inconsistent. We also need to
modify the appointment schedules because different Dentist has different schedules.
(b) Describe and illustrate the process of normalizing the table shown in Figure 1 to 3NF.
State any assumptions you make about the data shown in this table.