Database Systems, CSCI 4380-01 Sibel Adalı October 28, 2002

Question 1 Suppose you are given a relation R = (A, B, C, D, E) with the following functional dependencies: {CE → D, D → B, C → A}. a. Find all candidate keys. b. Identify the best normal form that R satisﬁes (1NF, 2NF, 3NF, or BCNF). c. If the relation is not in BCNF, decompose it until it becomes BCNF. At each step, identify a new relation, decompose and re-compute the keys and the normal forms they satisfy. Answer. a. The only key is {C, E} b. The relation is in 1NF c. Decompose into R1=(A,C) and R2=(B,C,D,E). R1 is in BCNF, R2 is in 2NF. Decompose R2 into, R21=(C,D,E) and R22=(B,D). Both relations are in BCNF.

Question 2 Suppose you are given a relation R=(A,B,C,D,E) with the following functional dependencies: {BC → ADE, D → B}. a. Find all candidate keys. b. Identify the best normal form that R satisﬁes (1NF, 2NF, 3NF, or BCNF). c. If the relation is not in BCNF, decompose it until it becomes BCNF. At each step, identify a new relation, decompose and re-compute the keys and the normal forms they satisfy. Answer. a. The keys are {B, C} and {C, D} b. The relation is in 3NF c. It cannot be put into BCNF, even if I remove D and put into a relation of the form (B,C,D) (I need C for the functional dependency), the resulting relation would not be in BCNF.

Question 3 Suppose you are given a relation R=(A,B,C,D,E) with the following functional dependencies: BD → E, A → C. a. Show that the decomposition into R1=(A,B,C) and R2=(D,E) is lossy. You can show using any method. My suggestion is to show how spurious tuples result from this decomposition with respect to the table below: A 1 1 B 2 8 C 3 3 D 4 4 E 5 4 1

C. show all dependencies that violate it. AB → C and DC → A are preserved in the ﬁrst relation.B.C. D} and {B. Hence. a. What are the keys of this relation? b. No dependency contains a superkey on its left side. Is the decomposition (A.C. explain why by showing one violation. a. F = {AB → C. b.D) (B.C. a. However.E. explain brieﬂy. show all dependencies that violate it. b. a. explain why by showing one violation.B. DC → E and E → F are preserved in the second relation. a lossy decomposition of the form (A. Is this relation is in BCNF? If not. If we were to decompose the relations into: A 1 1 B 2 8 C 3 3 D 4 4 E 5 4 and then join the two (in this case with a cartesian product). Is this relation in BCNF? If not. C. c.F). No. 2 . D}.F) a dependency preserving decomposition? If not.C. Is this relation in BCNF? If not. E → F }.B. AB → D. DC → AE. BC → E}. (C. all functional dependencies are actually violating this. F = {AB → C. c.D.E. Question 5 You are given the below functional dependencies for relation R(A.C.B. Yes.C).D.b. Is the decomposition (A. D → A. BC → D. explain brieﬂy.D. Answer. B. Find a single dependency from a single attribute X to another attribute Y such that when you add the dependency X → Y to the above dependencies. this decomposition is lossy. Answer. Is this relation in 3NF? If not. we would get: A 1 1 1 1 B 2 8 2 8 C 3 3 3 3 D 4 4 4 4 E 5 5 4 4 Tuples 2 and 3 are not in the original relation.D) (B. Question 4 You are given the following set of functional dependencies for a relation R(A.D.E). This decomposition cannot be made lossless. What are the keys of this relation? {A.E.E) can be made lossless by adding an FD B → C. the decomposition in part a is no longer lossy. b.B. The problem is there is no longer a way to make sure BD → E holds across two relations since they do not share any attributes.F) a dependency preserving decomposition? If not.D.

You do not have to list all the cases you test/consider for the algorithm.D. Suppose we decompose the above relation into the following two relations: R1(A. b.C.C. write down the functional dependencies that fall within that relation (you can decompose a dependency of the form AD → BF into two i.B. AD → B and AD → F when computing this).D.F. c.D) and R2(A. BC → E (given) ABC → AE by the augmentation rule. Find the minimal cover for the above set of functional dependencies using the algorithm described in class. C}. CD → EGC. 3 . show how using the Amstrong’s Axioms given in the book (p. BD → F.E). a. B}. then this decomposition is lossy. Keys for the relation: {A.E) R2(A. c. R1 A ’a’ ’e’ ’a’ ’b’ R2 A ’a’ ’e’ ’a’ ’b’ R1 A ’a’ ’e’ ’a’ ’b’ ’a’ ’a’ R2 B 122 236 199 213 122 199 C 1 4 1 2 1 1 D ’s1’ ’e2’ ’b5’ ’z8’ ’s1’ ’b5’ E ’a’ ’b’ ’c’ ’d’ ’a’ ’c’ B 122 236 199 213 C 1 4 1 2 D ’s1’ ’e2’ ’b5’ ’z8’ C 1 4 1 2 E ’a’ ’b’ ’c’ ’d’ Since the last two rows are not in the original relation. ﬁnd the keys for this relation.G). {B. but be succinct. a.B. D}. For each relation. {B.F.c. Is it in BCNF? Explain your reasoning. E → D. Is the following dependency implied by the above set of dependencies? If so.G) Use the functional dependencies in the minimal cover. A is part of a key. Not in BCNF since D → A does have a superkey on the left hand side.D. This question is independent of Question 2 above.e.C. You do not know the functional dependencies for this relation. 362-363): ABC → AE Answer. Give suﬃcient detail to show your reasoning. Using the functional dependencies that you computed in step a.C. F → C.B. b. Answer. F = {AD → BF.E). A ’a’ ’e’ ’a’ ’b’ B 122 236 199 213 C 1 4 1 2 D ’s1’ ’e2’ ’b5’ ’z8’ E ’a’ ’b’ ’c’ ’d’ Suppose this relation is decomposed into the following two tables: R1(A. Is this decomposition lossless? Explain your reasoning.C. Question 7 You are given the below set of functional dependencies for a relation R(A.E. In 3NF since in D → A. Show all steps where you make changes to the above set in detail.D.B. D → F }. Question 6 You are given the table below for a relation R(A.