You are on page 1of 3

Doctors relations table decomposed to achieve 2NF and 3NF:

Specialty Doctors
Primary Key: SpecialtyNumber Primary Key: DoctorID
Candidate Key: Name, Phone,
Foreign Key: DoctorID
SpecialtyNumber
Foreign Key: Specialty, HeadDoctorID

Patient Already in 3NF:


Patients
Primary Key: PatientID
Candidate Key: Name, Phone, Address, Datein, Allergies
Foreign Key: DoctorID

Appointment relations decomposed to achieve 3NF:


Patient Appointment Appointment
Primary Key: AppointmentID Primary Key: AppoitmentID
Candidate Key: DoctorID, PatientID,
Foreign Key: PatientID
AppointmentDate
Foreign Key: DoctorID, PatientID

First Normal Form:


In the 1NF the main problem to work on is to sort out atomicity, which means that a table cannot
contain multiple values otherwise the First Normal Form is violated. To qualify a table for first
normal form, we must remove repeated groups of values from the table, create a separated table
for related values, and identify each set of data with a primary key. For more hospital database
management system, all relations: Doctor, Patient, and Appointment have no duplicates, and
there no repeated values within attributes hence it is in the first normal form.

Second Normal Form:


Our entity diagram is in the 2NF if it is qualified by meeting requirements for the 1NF. A table is
set to be in the 2NF, only if it is in the 1NF, it should not have partial dependency which means
that no prime attributes must not depend on part of the candidate key To fix this, we need to
break the table into two parts, Doctor relation is not in the 2NF because it has partial
dependency. The candidate key is DoctorID, Name, Phone, SpecialtyNumber. Specialty is non-
key attribute which depends on the part of the candidate key. To fix this we create a separate
table for Specialty and Doctors, we have now achieved the second Normal Form.

Third Normal form:


3NF is used to reduce duplication of data and ensure referential integrity. To set the table in the
3NF, the table has to be in 2NF, no non-prime attribute is transitivity dependent on another non-
prime attribute which dependent.

E-R Diagram

You might also like