[Database] please show your work! Consider the relation Courses (C, T, H, R, S,
ID: 3825835 • Letter: #
Question
[Database] please show your work!
Consider the relation Courses (C, T, H, R, S, G), whose attributes may be thought of informally as course, teacher, hour, room, student, and grade. Let the set of FD ' s for Courses be C --> T, HR --> C, HT --> R, HS --> R and CS --> G. Intuitively, the first says that a course has a unique teacher, and the second says that only one course can meet in a given room at a given hour. The third says that a teacher can be in only one room at a given hour, and the fourth says the same about students. The last says that students get only one grade in a course.
Determine keys using the Left, Middle, Right method.
Explanation / Answer
hi,
The main relation is R(C,T,H,R,S,G). Given functional dependencies are 1) C -> T 2) HT -> R 3) HR -> C 4) HS -> R
5) CS -> G
Now, we will apply Left, middle and right method.
There we will differentiate all attributes based on which side of the dependency they are occurring. Here is the table
L -------- M -------- R
H C G
S T
R
The attributes appear only on the Right-hand side will not be a part of any key. so we can leave G.
now we have to Find the closure of all the possible combinations of left and middle attributes to determine all candidate keys.
1) H closure i.e., H+ ->empty 2) S+ ->empty 3) HC+ -> HCTR 4) HT+ -> HTRC 5) HR+ ->HRCT 6) HS+ -> HSRCTG
in all the combinations only HS closure is able to derive all the attributes. HS will be the key and any other attribute combination with HS will be a candidate key.
Thank you, Please comment below for any other calrifications
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.