Uploaded by addyakrom

Assignment 4

advertisement
1. a) {theater → city} - Theater uniquely determines the city attribute, i.e. there is only one city
where the theater is in, thus each theater has a different name.
{title, city → theater} - Title and city as a composite key can uniquely identify the theater
attribute. This means there is only one theater in a given city that can show a certain movie.
b) The keys are {title, theater} and {theater, city}.
c) It is not in BCNF because {title, city → theater} violates the BCNF rule as the non-key
attribute city determines the attribute theater. Decomposition with respect to F is:
Showings(title, theater)
Theaters(theater, city)
Showings has the attributes uniquely determined by title and theater, and Theaters has the
attributes uniquely determined by the attribute theater. The join of these two relations will
produce the original relation, thus it is lossless.
d) Yes, because all the functional dependencies in F can be found through the new relations in
Showings and Theaters, {theater → city} is in Theaters and {title, city → theater} is in the join of
Showings and Theaters on the theater attribute. Therefore, the decomposition is dependency
preserving.
2. a) HR → C shows that a course at a given hour has a unique room, i.e. a room is assigned to
a unique course at a particular hour. HT → R shows that a teacher and a given hour has a
unique room, i.e. a teacher teaches in a unique room at a particular hour. HS → R shows that a
student and a given hour has a unique room, i.e. a student is assigned to a room at a particular
hour. CS → G shows that a student and their course can uniquely determine the grade that the
student is in.
b) The keys are {C, H, S} and {C, H, R}.
c) HR → C violates the BCNF rule as a non-key attribute HR is determining the key attribute C.
d) It is not in 3NF as HR → C violates the 3NF rule because a non-key attribute HR is
determining a key attribute C.
e) A lossless decomposition is:
Teaching(C, T, H, R)
Taking(C, S, G)
Teaching has the attributes uniquely determined by C and Taking has the attributes uniquely
determined by the composite key CS. This is lossless because their join on C will produce the
original relation.
f) It is dependency preserving as the functional dependencies from F can be found from
Teaching and Taking. C → T is preserved in Teaching and CS → G is preserved in Taking. Thus
the decomposition is dependency preserving.
Download