Académique Documents
Professionnel Documents
Culture Documents
Lecture 16 Normalization
Steps in normalization
Table with multivalued attributes 1st normal form
Remove partial dependencies Remove multivalued attributes
Remove transitive dependencies Remove remaining anomalies resulting from functional dependencies Remove multivalued dependencies Remove remaining anomalies
3NF (cont.)
Due to the transitive dependency, there will be update anomalies, like
Consider the following relation: (st_id, st_name, course_no, course_name, sec_no, classroom,inst_id, inst_name, no_of_sections) with the functional dependencies
st_id st_name course_no course_name ,no_of_sections st_id , course_no, sec_no course_no, sec_no classroom, inst_id inst_id inst_name
st_id , course_no, course_no , sec_no course_no, sec_no classroom, inst_id Therefore st_id , course_no, classroom, inst_id In the same way course_no, sec_no classroom, inst_id inst_id inst_name Therefore course_no, sec_no inst_name
cno
cno cname , cno ins_ic ins_ic chamber no Decompose into (cno,cname,ins_ic) (ins_ic,chamber no)
ClientInterview
ClientNo
CR76 CR75 CR74 CR56 CR55
interviewDate
13-May-02 13-May-02 13-May-02 1-Jul-02 13-May-02
interviewTime
10.30 12.00 12.00 10.30 10:30
staffNo
SG5 SG5 SG37 SG5 SG6
roomNo
G101 G101 G102 G102 G103
FD1 clientNo, interviewDate interviewTime, staffNo, roomNo (Primary Key) FD2 staffNo, interviewDate, interviewTime clientNo , roomNo (Candidate key) FD3 roomNo, interviewDate, interviewTime clientNo, staffNo (Candidate key) FD4 staffNo, interviewDate roomNo (not a candidate key)
As a consequece the ClientInterview relation may suffer from update anmalies. For example, two tuples have to be updated if the roomNo need be changed for staffNo SG5 on the 13-May-02.
Example of BCNF
To transform the ClientInterview relation to BCNF, we must remove the violating functional dependency by creating two new relations called Interview and StaffRoom as shown below, Interview (clientNo, interviewDate, interviewTime, staffNo) StaffRoom(staffNo, interviewDate, roomNo)
Interview
ClientNo
CR76 CR75 CR74 CR56 CR55
interviewDate
13-May-02 13-May-02 13-May-02 1-Jul-02 13-May-02
interviewTime
10.30 12.00 12.00 10.30 10:30
staffNo
SG5 SG5 SG37 SG5 SG6
StaffRoom
staffNo
SG5 SG37 SG5 SG6
interviewDate
13-May-02 13-May-02 1-Jul-02 13-May-02
roomNo
G101 G102 G102 G103
4NF (cont.)
COURSE_OFFERING
4NF (cont.)
Ex: (c_no, teacher_id, textbook_code) COURSE_OFFERING
course_no
techer_id
textbook_code
In this example all the 3 attributes are candidate key, but teacher_id and textbook_code dont have any relationship. To remove the multivalued dependency, decompose the relation in two new relations.
course_no techer_id
course_no textbook_code