Boyce-Codd Normal Form (BCNF) Definition R in 1NF and Every determinant (the left side) of any FD is a candidate key.
Not in BCNF SurgeryRoomSchedule (staffNo, dentistName, patNo, patName, surgeryNo, date, time) PK: surgeryNo, Date, Time AK: staffNo, Date, Time patNo, Date, Time FK: None FDs: surgeryNo, Date, Time ===> staffNo, patNo (All) staffNo, Date, Time ===> surgeryNo, patNo (All) patNo, Date, Time ===> staffNo, surgeryNo (All) (The determinants are NOT candidate keys) staffNo ===> dentistName (transitive on PK) patNo ===> patName (transitive on PK) staffNo, Date ===> surgeryNo (surgeryNo is a PK attribute!)
Different PK SurgeryRoomSchedule (staffNo, dentistName, patNo, patName, surgeryNo, date, time) PK: staffNo, date, time AK: surgeryNo, date, time patNo, date, time FK: None staffNo, Date, Time ===> patNo, surgeryNo (All) surgeryNo, Date, Time ===> staffNo, patNo (All) patNo, Date, Time ===> staffNo, surgeryNo (All) staffNo ===> dentistName (partial on PK) patNo ===> patName (transitive on PK) staffNo, Date ===> surgeryNo (partial on PK!)
SurgeryRoomSchedule (staffNo, dentistName, patNo, patName, surgeryNo, date, time) PK: surgeryNo, Date, Time FDs: surgeryNo, Date, Time ===> staffNo, patNo (All) staffNo, Date, Time ===> surgeryNo, patNo (All) patNo, Date, Time ===> staffNo, surgeryNo (All) staffNo ===> dentistName (determinant is NOT candidate key) patNo ===> patName (determinant is NOT candidate key) staffNo, Date ===> surgeryNo (determinant is NOT candidate key) New Tables in BCNF Staff (staffNo, dentistName) Patient (patNo, patName) RoomAllocation (staffNo, Date, surgeryNo) Schedule (staffNo, patNo, date, time) PK & FK!
Staff (staffNo, dentistName) PK: staffNo AK: None FK: None FDs: staffNo ===> dentistName SurgeryRoomSchedule (staffNo, patNo, date, time) PK: staffNo, date, time AK: patNo, date, time FK: staffNo references Staff patNo references Patient staffNo, Date references Room FDs: staffNo, Date, Time ===> patNo patNo, Date, Time ===> staffNo PK and AK can be switched. Patient (patNo, patName) PK: patNo AK: None FK: None FDs: patNo ===> patName RoomAllocation (staffNo, Date, surgeryNo) PK: staffNo, Date AK: None FK: staffNo references Staff staffNo, Date ===> surgeryNo
Staff (staffNo, dentistName) PK: staffNo AK: None FK: None FDs: staffNo ===> dentistName staffNo dentistName ------------- -------------------- S1011 Tony Smith S1024 Helen Pearson S1032 Robin Plevin S1035 Tony Smith dentistName will be removed from the original table, But staffNo remains in the original table.
Patient (patNo, patName) PK: patNo AK: None FK: None FDs: patNo ===> patName patNo patName ------------ ------------------- P100 Gillian White P105 Jill Bell P108 Ian MacKay P110 John Walker patName will be removed from the original table, But patNo remains in the original table.
RoomAllocation (staffNo, Date, surgeryNo) PK: staffNo, Date AK: None FK: staffNo references Staff FDs: staffNo, Date ===> surgeryNo staffNo Date surgeryNo ---------- ------------ -------------- S1011 12-Sep-04 S15 S1024 12-Sep-04 S15 S1024 14-Sep-04 S10 S1032 14-Sep-04 S13 S1035 12-Sep-04 S15 surgeryNo will be removed from the original table, But staffNo and Date remains in the original table.
SurgeryRoomSchedule (staffNo, patNo, date, time) PK: patNo, date, time AK: staffNo, date, time FK: staffNo references Staff patNo references Patient staffNo, Date references RoomAllocation FDs: staffNo, Date, Time ===> patNo patNo, Date, Time ===> staffNo staffNo patNo date time ---------- ---------- ------------- ---------- S1011 P100 12-Sep-04 10:00 S1011 P105 12-Sep-04 12:00 S1024 P108 12-Sep-04 11:00 S1024 P108 14-Sep-04 14:00 S1032 P105 14-Sep-04 16:30 S1032 P110 14-Sep-04 18:00 S1035 P110 12-Sep-04 14:00
SurgeryRoomSchedule (staffNo, patNo, date, time, surgeryNo) PK: patNo, date, time AK: staffNo, date, time FK: staffNo references Staff patNo references Patient staffNo, Date references RoomAllocation FDs: staffNo, Date, Time ===> patNo patNo, Date, Time ===> staffNo staffNo, Date ===> surgeryNo
Schedule (staffNo, patNo, date, time) PK: patNo, date, time AK: staffNo, date, time FK: staffNo references Staff patNo references Patient staffNo, Date references RoomAllocation FDs: staffNo, Date, Time ===> patNo patNo, Date, Time ===> staffNo staffNo patNo date time ---------- ---------- ------------- ---------- S1011 P100 12-Sep-04 10:00 S1011 P105 12-Sep-04 12:00 S1024 P108 12-Sep-04 11:00 S1024 P108 14-Sep-04 14:00 S1032 P105 14-Sep-04 16:30 S1032 P110 14-Sep-04 18:00 S1035 P110 12-Sep-04 14:00