《数据库系统基础教程第三章答案》由会员分享,可在线阅读,更多相关《数据库系统基础教程第三章答案(21页珍藏版)》请在金锄头文库上搜索。
1、Exercise 3.1.1Answers for this exercise may vary because of different interpretations. Some possible FDs:Social Security numbernameArea code stateStreet address, city, state zipcodePossible keys:Social Security number, street address, city, state, area code, phone numberNeed street address, city, st
2、ate to uniquely determine location. A person could havemultiple addresses. The same is true for phones. These days, a person could have a landline and a cellular phoneExercise 3.1.2Answers for this exercise may vary because of different interpretations Some possible FDs:ID x-position, y-position, z-
3、positionID x-velocity, y-velocity, z-velocity x-position, y-position, z-position IDPossible keys:IDx-position, y-position, z-positionThe reason why the positions would be a key is no two molecules can occupy the same point.The superkeys are any subset that contains A1. Thus, there are 2(n-1) such su
4、bsets, since each of the n-1 attributes A 2 through A n may independently be chosen in or out.The superkeys are any subset that contains A1 orA2.There are2(n-1)such subsetswhenconsidering A1 and the n-1 attributes A2 throughAn.There are2(n-2)such subsetswhenconsidering A2 and the n-2 attributesA3 th
5、rough An. We do not count A1 in these subsetsbecause they are already counted in the first group of subsets. The total number of subsets is 2 (n-1) + 2 (n-2) .The superkeys are any subset that contains A considering A 1,A 2 and the n-2 attributes A1,A 2 or A3 through A3,A 4. There are 2n. There are
6、2(n-2)such subsets when-2 (n-4) such subsetswhen considering A3,A4 and attributes Aand A2. We get the 2(n-4) term becauseA 1,A 2 to avoid double counting. The total number of subsets is 2The superkeys are any subset that contains A consideringA 1,A 2 and the n-2 attributesconsidering A1,A3 and the n
7、-3 attributes A5 through A n along with the individual attributes A we have to discard the subsets that (n-2) + 2 (n-2) 1,A 3. There are 2 (n-2) An. There are 2 n We do not count A1,A 2 or A A3 through 4 through A1 contain the key -2 (n-4).such subsets when such subsets when 2 in these subsets(n-2)(
8、n-3)is 2because they are already counted in the first group of subsets. The total number of subsetsWe could try inference rules to deduce new dependencies until we are satisfied we have them all. A more systematic way is to consider the closures of all 15 nonempty sets of attributes.For the single a
9、ttributes we have A+ = A, B+ = B, C+ = ACD, and D+ = AD. Thus, theonly new dependency we get with a single attribute on the left is CA.Now consider pairs of attributes: AB + = ABCD, so we get new dependency AB D. AC + = ACD, and AC D is nontrivial. AD + = AD, so nothing new. BC + = ABCD, so we get B
10、C A, and BC D. BD + = ABCD, giving us BD A and BD C. CD + = ACD, giving CD A.For the triples of attributes, ACD+ = ACD, but the closures of the other sets are each ABCD.Thus, we get new dependencies ABC D, ABD C, and BCD A.Since ABCD + = ABCD, we get no new dependencies.The collection of 11 new depe
11、ndencies mentioned above are:C A, AB D, AC D, BC A, BC D, BD A, BD C, CD A, ABC D, ABD C, and BCD A.From the analysis of closures above, we find that AB, BC, and BD are keys. All other sets either do not have ABCD as the closure or contain one of these three sets.The superkeys are all those that con
12、tain one of those three keys. That is, a superkey thatis not a key must contain B and more than one of A, C, and D. Thus, the (proper) superkeys are ABC, ABD, BCD, and ABCD.i) For the single attributes we have A+ = ABCD, B + = BCD, C + = C, and D + = D. Thus,the new dependencies are AC and A D.Now c
13、onsider pairs of attributes:AB + = ABCD, AC + = ABCD, AD + = ABCD, BC + = BCD, BD + = BCD, CD + = CD. Thus the new dependencies are AB C, AB D, AC B, AC D, AD B, AD C, BC D and BD C.For the triples of attributes, BCD+ = BCD, but the closures of the other sets are each ABCD.Thus, we get new dependenc
14、ies ABCD, ABD C, and ACD B.Since ABCD + = ABCD, we get no new dependencies.The collection of 13 new dependencies mentioned above are:A C, A D, AB C, AB D, AC B, AC D, AD B, AD C, BC D, BD C, ABC D, ABD C and ACD B. + + + +ii) For the single attributes we have A= A, B = B, C = C, and D= D. Thus, ther
15、eare no new dependencies.Now consider pairs of attributes:AB + = ABCD, AC + = AC, AD + = ABCD, BC + = ABCD, BD + = BD, CD + = ABCD. Thus the new dependencies are ABD, AD C, BC A and CD B.For the triples of attributes, all the closures of the sets are each ABCD. Thus, we get newdependencies ABC D, ABD C, ACD B and BCD A. Since ABCD + = ABCD, we get no new dependencies. The collection of 8 new dependencies mentioned above are:AB D, AD C, BC A, CD B, ABCD, ABD C, ACD B and BCD A.iii) For the single attributes we have A Thus,