Lab1 FD Spring2023
Lab1 FD Spring2023
Normal forms
Exercise 1. You have been given a form which shows the details of tests done by different patients during
their visits to the hospital. In fact, when a patient goes to the hospital, he/she asks to be examined by a doctor of
a department. This doctor could ask him/her to do some tests and/or send him/her to another doctor of another
department. Then, the other doctor could also ask him/her to do other tests. A doctor belongs to only one
department. The Amount here is the remaining amount that the patient must pay for the test, after subtracting
the amount paid by the security social.
The hospital would like to set up a relational database corresponding to this form.
a. Normalize the database into 1NF including only one table. Give the content of the table as well
as the list of functional dependencies for the table.
b. Normalize the database into 2NF. Give the content of each table after as well as the list of
functional dependencies for each table after normalizing.
c. Normalize the database into 3NF. Give the content of each table after as well as the list of
functional dependencies for each table after normalizing.
P_ID: Patient’s ID
P_Name: Patient’s Name
D_ID: Doctor’s ID
D_Name: Doctor’s Name
DeptID: Department’s ID
DeptName: Department’s Name
Visit Time P_ID P_Name Phone D_ID D_Name DeptI DeptName TestI TestName Price Quantity Amount
ID D D
1 2019/12/23 298 Mary 0987654534 1002 Alan 101 Maternity T01 Diabetes Blood 15 3 40
09:10:00 Walls Smith Test
T02 2D 20 1 18
ultrasonography
1 2019/12/23 298 Mary 0987654534 1001 Jill Young 102 Gastroenterology T03 Anorectal function 30 1 30
09:10:00 Walls testing
2 2019/12/23 300 Bob 0896755888 1001 Jill Young 102 Gastroenterology T03 Anorectal function 30 1 30
10:30:00 Jackson testing
T04 24-hour pH 45 2 90
monitoring
3 2019/12/23 3008 Peter 0675389799 1003 Mary 102 Gastroenterology T01 Diabetes Blood 15 2 30
10:30:00 Smith Weber Test
T05 Capsule endoscopy 150 1 120
4 2019/12/27 298 Mary 0987654534 1003 Mary 102 Gastroenterology T04 24-hour pH 45 1 37
14:30:00 Walls Weber monitoring
Exercise 2: Having the following form to input the results of students:
Roll# Name Birthdate Class Department CourseID CourseName Credits Results
a. Normalize the database into 1NF including only one table. Give the content of the table as well
as the list of functional dependencies for the table.
b. Normalize the database into 2NF. Give the content of each table after as well as the list of
functional dependencies for each table after normalizing.
c. Normalize the database into 3NF. Give the content of each table after as well as the list of
functional dependencies for each table after normalizing.