4. Examine the table shown below and the set of functional dependencies on its attributes:
CourseRmAlloc (CourseId, CourseName, Year, Lecturer, Enrollment, RoomId, RoomCapacity, Day, Time)
FD = {CourseId -> CourseName,
CourseName -> CourseId,
CourseId, Year -> Lecturer,
CourseId, Year -> Enrollment,
RoomId -> RoomCapacity,
RoomId, Year, Day, Time -> CourseId,
CourseId, Year, Day, Time -> RoomId}
(a) Find all candidate keys of this table
(b) Decompose this table into a design into BCNF
Answer:
(a) There are three candidate keys in this table:
1) CourseId
2) Year, Day, Time, CourseName
3) Year, Day, Time, RoomId
(b) This table can be decomposed into the following in BCNF (and also in 3NF):
CourseTeaching (CourseId, Year, Lecturer, Enrollment)
Room (RoomId, RoomCapacity)
CourseRoomAlloc (CourseId, Year, Day, Time, RoomId)
Course (CourseId, CourseName)