Computer Science
Course: CS 2203
Programming Assign. Unit 4
The basic form of the data:
Doctor:
Attributes Type Optional Key
DoctorID Number/Unique No Primary
Name Text No
Phone Number Yes
SpecialtyNumber Number No
Specialty Text No
HeadID Number Yes Foreign
Patient:
Attributes Type Optional Key
PatientID Number/Unique No Primary
Name Text No
Phone Number Yes
Email Text Yes
Address Text Yes
AddedDate Date No
Allergies Text No
DoctorID Number No Foreign
Appointment :
Attributes Type Optional Key
AppointmentID Number/Unique No Primary
DoctorID Number No Foreign
PatientID Number No Foreign
BloodPressure Number Yes
Weight Number Yes
AppointmentDate Date No
TreatmentNotes Text Yes
Medicines Text Yes
Computer Science
Course: CS 2203
The First normal form (1NF) :
The first step in normalization is to put all the recurring fields into separate tables and
assign them appropriate keys
Patient:
The patient table has an Allergies attribute that can have multiple values, so it needs to be put into a
separate table
Attributes Type Optional Key
PatientID Number/Unique No Primary
Name Text No
Phone Number Yes
Email Text Yes
Address Text Yes
AddedDate Date No
DoctorID Number No Foreign
Allergies:
Attributes Type Optional Key
ID Number/Unique No Primary
PatientID Number No Foreign
Allergies Text No
Appointment :
The patient table has a Medicines attributes that can have multiple values. So it should be placed in
a separate table
Attributes Type Optional Key
AppointmentID Number/Unique No Primary
DoctorID Number No Foreign
PatientID Number No Foreign
BloodPressure Number Yes
Weight Number Yes
AppointmentDate Date No
TreatmentNotes Text Yes
Medicines:
Attributes Type Optional Key
ID Number/Unique No Primary
AppointmentID Number No Foreign
Medicines Text No
Computer Science
Course: CS 2203
The Second normal form (2NF):
The second step is to remove subsets of data that apply to multiple rows of the table and
put them into separate tables.
Doctor:
The specialty in the doctor's table depends entirely on the specialty number, so it should be placed
in a separate table
Attributes Type Optional Key
DoctorID Number/Unique No Primary
Name Text No
Phone Number Yes
SpecialtyNumber Number No Foreign
HeadID Number Yes Foreign
Specialty:
Attributes Type Optional Key
SpecialtyNumber Number/Unique No Primary
SpecialtyName Text No
The Third normal form (3NF):
The third step is to remove columns that do not depend on the primary key.
PatientID is temporarily dependent on the appointment and to implement 3NF, we create a
separate PatientApointment table.
Appointment :
Attributes Type Optional Key
AppointmentID Number/Unique No Primary
BloodPressure Number Yes
Weight Number Yes
AppointmentDate Date No
TreatmentNotes Text Yes
PatientApointment:
Attributes Type Optional Key
ID Number/Unique No Primary
DoctorID Number No Foreign
PatientID Number No Foreign
AppointmentID Number No Foreign
Computer Science
Course: CS 2203
Attributes Type Optional Key
PatientID Number/Unique No Primary
Name Text No
Phone Number Yes
Email Text Yes
Address Text Yes
AddedDate Date No
Patient:
Attributes Type Optional Key
PatientID Number/Unique No Primary
Name Text No
Phone Number Yes
Email Text Yes
Address Text Yes
AddedDate Date No