



版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.Answers for this exercise may vary because of different interpretations.Some possible FDs:Social Security numbernameArea codestateStreet address, city, statezipcodePossible keys:Social Security number, street address, city, state, area code, phone numberNeed street address, city, state to uniquely
2、determine location. A person could have multiple addresses. The same is true for phones. These days, a person could have a landline and a cellular phoneAnswers for this exercise may vary because of different interpretationsSome possible FDs:IDx-position, y-position, z-positionIDx-velocity, y-velocit
3、y, z-velocityx-position, y-position, z-positionIDPossible 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 A. Thus, there are 2(n-1)such subsets, since1each of the n-1 attribu
4、tes A2 through An may independently be chosen in or out.Exercise 3.1.3bThe superkeys are any subset that contains A1 or A2. There are 2(n-1)such subsets whenconsidering A1and the n-1 attributes A2through An. There are 2(n-2)such subsets whenconsidering A2and the n-2 attributes A3through An. We do no
5、t count A1 in these subsetsbecause they are already counted in the first group of subsets. The total number ofsubsets is 2(n-1)+ 2 (n-2) .1/31.The superkeys are any subset that contains A,A or A,A4. There are 2(n-2)such subsets123when considering A123n(n-2) 2(n-4)such,A and the n-2 attributes Athrou
6、gh A . There are 2subsets when considering A3,A 4 and attributes A5through A n along with the individualattributes A1and A2(n-4)term because we have to discard the subsets that. We get the 2(n-2) +contain the key A1,A 2 to avoid double counting. The total number of subsets is 22(n-2) 2 (n-4) .Exerci
7、se 3.1.3dThe superkeys are any subset that contains A1213. There are 2(n-2)such subsets,A or A,A(n-3)when considering A1,A 2 and the n-2 attributes A3through A n. There are 2such subsetswhen considering A1,A 3 and the n-3 attributes A4 through An We do not count A2 in thesesubsets because they are a
8、lready counted in the first group of subsets. The total numberof subsets is 2(n-2)+ 2 (n-3) .We 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 attribu
9、tes 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 ABD. AC+ = ACD, and ACD is nontrivial. AD+= AD, so nothing new. BC+ = ABCD, so we get BCA, and BCD. BD + =
10、 ABCD, giving usBD A and BD C. CD += ACD, giving CDA.+= ACD, but the closures of the other sets are eachFor the triples of attributes, ACDABCD. Thus, we get new dependencies ABCD, ABDC, and BCDA.Since ABCD + = ABCD, we get no new dependencies.The collection of 11 new dependencies mentioned above are
11、:C A,AB D,AC D,BCA, BC D, BDA, BDC, CD A, ABCD, ABDC, 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 contain one of those three keys. That i
12、s, a superkey that is 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.2/31.i) For the single attributes we have A+ = ABCD, B+ = BCD, C+ = C, and D+ = D. Thus,the new dependencies are AC and AD.Now consider pairs of attributes:AB + =
13、 ABCD, AC+ = ABCD, AD + = ABCD, BC+ = BCD, BD+ = BCD, CD+ = CD. Thus the newdependencies are ABC, ABD, ACB, ACD, ADB, ADC, BCD and BDC.For the triples of attributes, BCD+ = BCD, but the closures of the other sets are eachABCD. Thus, we get new dependencies ABCD, ABDC, and ACDB.Since ABCD + = ABCD, w
14、e 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,there are no new dependencies.Now consider pairs of attributes
15、:AB + = ABCD, AC+ = AC, AD+ = ABCD, BC+ = ABCD, BD+ = BD, CD+ = ABCD. Thus the newdependencies are ABD, ADC, BC A and CDB.For the triples of attributes, all the closures of the sets are each ABCD. Thus, we getnew dependencies ABCD, ABDC, ACDB and BCDA.+= ABCD, we get no new dependencies.Since ABCDTh
16、e collection of 8 new dependencies mentioned above are:ABD, ADC, BCA, CDB, ABCD, ABD C, ACDB and BCDA.iii) For the single attributes we have A+= ABCD, B+ = ABCD, C+ = ABCD, and D+ =ABCD. Thus, the new dependencies are AC, AD, BD, BA, CA, C B, D B and DC.Since all the single attributes closures are A
17、BCD, any superset of the singleattributes will also lead to a closure of ABCD. Knowing this, we can enumerate the restof the new dependencies.The collection of 24 new dependencies mentioned above are:AC, AD, BD, BA, CA, CB, DB, DC, ABC, ABD, AC B, ACD, AD B, AD C,BCA, BCD, BDA, BDC, CDA, CDB, ABCD,
18、ABDC, ACDB and BCDA.3/31.i)ii)iii)i)ii)iii)Exercise 3.2.3aSince A 1A2 AnC contains A1A2 An, then the closure of A1A2 AnC contains B. Thus it followsthat AAACB.1 2nExercise 3.2.3bFrom 3.2.3a, we know that A1A2 AnCB. Using the concept of trivial dependencies, we canshow that A1A2 AnCC. Thus A 1A2AnCBC
19、.Exercise 3.2.3cFrom A 1A2 AnE1E2 Ej , we know that the closure contains B1B2 Bm because of the FD A1A2AnB B B . The BB B and the EE E combine to form the CC C . Thus the closure of1 2m1 2m1 2j1 2kA1A2AnE1E2 Ejcontains D as well. Thus, A1A2 AnE1E2EjD.Exercise 3.2.3dFrom A 1A2 AnC1C2 Ck , we know tha
20、t the closure contains B1B2 Bm because of the FD A1A2An1 2m1 2k1 2n 1 2k1 2jB B B . The CC C also tell us that the closure of AAACC C contains DD D . Thus,1 2n 1 2k1 2k 1 2jAAACCC BBBDDD.Exercise 3.2.4aIf attribute A represented Social Security Number and B represented a person s name,then we would
21、assume AB but BA would not be valid because there may be many peoplewith the same name and different Social Security Numbers.4/31.Let attribute A represent Social Security Number, B represent gender and C represent name.Surely Social Security Number and gender can uniquely identify a person s name (
22、i.e.ABC). A Social Security Number can also uniquely identify a person s name (i.e. AC).However, gender does not uniquely determine a name (i.e. BC is not valid).Let attribute A represent latitude and B represent longitude. Together, both attributescan uniquely determine C, a point on the world map
23、(i.e. ABC). However, neither A nor Bcan uniquely identify a point (i.e. AC and BC are not valid).Given a relation with attributes A1A A , we are told that there are no functional2ndependencies of the form B1 B2 Bn-1C where B 1B2 Bn-1is n-1 of the attributes from A1A2 Anand C is the remaining attribu
24、te from AA A . In this case, the set B1B Band any12n2n-1subset do not functionally determine C. Thus the only functional dependencies that we canmake are ones where C is on both the left and right hand sides. All of these functionaldependencies would be trivial and thus the relation has no nontrivia
25、l FDs.Exercise 3.2.6Let s prove this by using the contrapositive. We wish to show that if X+ is not a subsetof Y+, then it must be that X is not a subset of Y.If X+ is not a subset of Y+, there must be attributes A1A2 An in X + that are not in Y+. Ifany of these attributes were originally in X, then
26、 we are done because Y does not containany of the A A A . However, if the A1A A were added by the closure, then we must12n2nexamine the case further. Assume that there was some FD C1C2CmA1A2 Ajwhere A 1A2Aj issome subset of AA A . It must be then that CC C or some subset of CC C is in X.1 2n1 2m12mH
27、owever, the attributes C1C2Cm cannot be in Y because we assumed that attributes A1A2 Anare only in X+and are not in Y. Thus, X is not a subset of Y.By proving the contrapositive, we have also proved if X? Y, then X+?Y .+The algorithm to find X is outlined on pg. 76. Using that algorithm, we can prov
28、e that (X+ ) + = X +. We will do this by using a proof by contradiction.Suppose that (X+) + X +. Then for (X+) +, it must be that some FD allowed additionalattributes to be added to the original set X+. For example, X+A where A is someattribute not in X+. However, if this were the case, then X+ woul
29、d not be the closure of X.The closure of X would have to include A as well. This contradicts the fact that we were5/31.given the closure of X, X+. Therefore, it must be that (X)= Xor else Xis not theclosure of X.Exercise 3.2.8aIf all sets of attributes are closed, then there cannot be any nontrivial
30、 functional1A2.A n + contains Bdependencies. Suppose A 1A2.A n B is a nontrivial dependency. Then Aand thus A1A .Anis not closed.2If the only closed sets are? and A,B,C,D, then the following FDs hold:ABACADBABCBDCACBCDDADBDCABCABDACBACDADBADCBCABCDBDABDCCDACDBABC DABD CACD BBCD AIf the only closed s
31、ets are?, A,B and A,B,C,D, then the following FDs hold:A BB ACACBCDDADBDCACBACDADBADCBCABCDBDABDCCDACDBABC DABD CACD BBCD A6/31.We can think of this problem as a situation where the attributes A,B,C represent cities and the functional dependencies represent one way paths between the cities. The mini
32、mal bases are the minimal number of pathways that are needed to connect the cities. We do not want to create another roadway if the two cities are already connected.The systematic way to do this would be to check all possible sets of the pathways. However, we can simplify the situation by noting tha
33、t it takes more than two pathways to visit the two other cities and come back. Also, if we find a set of pathways that is minimal, adding additional pathways will not create another minimal set.The two sets of minimal bases that were given in example 3.11 are:AB,BC,CAAB,BA,BC,CBThe additional sets o
34、f minimal bases are:CB, BA, ACAB, AC, BA, CAAC, BC, CA, CBExercise 3.2.10aWe need to compute the closures of all subsets of ABC, although there is no need tothink about the empty set or the set of all three attributes. Here are the calculationsfor the remaining six sets:A +=AB +=B+C =ACEAB +=ABCDE+A
35、C =ACEBC +=ABCDEWe ignore D and E, so a basis for the resulting functional dependencies for ABC is: CAand ABC. Note that BC->A is true, but follows logically from C->A, and therefore may beomitted from our list.We need to compute the closures of all subsets of ABC, although there is no need to
36、 think about the empty set or the set of all three attributes. Here are the calculations for the remaining six sets:+A =AD+B =B+C =C+AB =ABDE7/31.+AC =ABCDE+We ignore D and E, so a basis for the resulting functional dependencies for ABC is: ACB.We need to compute the closures of all subsets of ABC,
37、although there is no need to think about the empty set or the set of all three attributes. Here are the calculations for the remaining six sets:+A =A+B =B+C =C+AB =ABD+AC =ABCDE+BC =ABCDEWe ignore D and E, so a basis for the resulting functional dependencies for ABC is: ACBand BCA.Exercise 3.2.10dWe
38、 need to compute the closures of all subsets of ABC, although there is no need tothink about the empty set or the set of all three attributes. Here are the calculationsfor the remaining six sets:A +=ABCDEB +=ABCDEC +=ABCDEAB +=ABCDE+AC =ABCDEBC +=ABCDEWe ignore D and E, so a basis for the resulting
39、functional dependencies for ABC is: AB,B C and C A.Exercise 3.2.11For step one of Algorithm 3.7, suppose we have the FD ABCDE. We want to use Armstrongs Axioms to show that ABCD and ABCE follow. Surely the functional dependencies DEDand DEE hold because they are trivial and follow the reflexivity pr
40、operty. Using thetransitivity rule, we can derive the FD ABCD from the FDs ABCDE and DED. Likewise,we can do the same for ABCDE and DEE and derive the FD ABCE.For steps two through four of Algorithm 3.7, suppose we have the initial set ofattributes of the closure as ABC. Suppose also that we have FD
41、s CD and DE. Accordingto Algorithm 3.7, the closure should become ABCDE. Taking the FD CD and augmenting bothsides with attributes AB we get the FD ABCABD. We can use the splitting method in step8/31.one to get the FD ABCD. Since D is not in the closure, we can add attribute D. Takingthe FD D E and
42、augmenting both sides with attributes ABC we get the FD ABCDABCDE.Using again the splitting method in step one we get the FD ABCDE. Since E is not in theclosure, we can add attribute E.Given a set of FDs, we can prove that a FD F follows by taking the closure of the leftside of FD F. The steps to co
43、mpute the closure in Algorithm 3.7 can be mimicked byArmstrong s axioms and thus we can prove F from the given set of FDs using Armstrong saxioms.Exercise 3.3.1aIn the solution to Exercise 3.2.1 we found that there are 14 nontrivial dependencies,including the three given ones and eleven derived depe
44、ndencies. They are: CA,C D,D A,ABD, AB C, ACD, BCA, BCD, BDA, BDC, CDA, ABCD, ABDC, and BCDA.We also learned that the three keys were AB, BC, and BD. Thus, any dependency above thatdoes not have one of these pairs on the left is a BCNF violation. These are: CA, CD,D A,ACD, and CD A.One choice is to
45、decompose using the violation CD. Using the above FDs, we get ACD andBC as decomposed relations. BC is surely in BCNF, since any two-attribute relation is.Using Algorithm 3.12 to discover the projection of FDs on relation ACD, we discover thatACD is not in BCNF since C is its only key. However, DA i
46、s a dependency that holds inABCD and therefore holds in ACD. We must further decompose ACD into AD and CD. Thus, thethree relations of the decomposition are BC, AD, and CD.Exercise 3.3.1bBy computing the closures of all 15 nonempty subsets of ABCD, we can find all thenontrivial FDs. They are BC, BD,
47、 ABC, ABD, BCD, BDC, ABCD and ABDC. Fromthe closures we can also deduce that the only key is AB. Thus, any dependency above thatdoes not contain AB on the left is a BCNF violation. These are: BC,B D,BCD andBD C.One choice is to decompose using the violation BC. Using the above FDs, we get BCD andAB as decomposed relations. AB is surely in BCNF, since any two-attribute relation is.Using Algorithm 3.12 to discover the projection of FDs on relation BCD, we discover that BCD is in BCNF since B is i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 江西科技师范大学《ACCASBR战略商务报告》2023-2024学年第二学期期末试卷
- 合肥师范学院《混凝土结构与性能A》2023-2024学年第二学期期末试卷
- 云南师范大学《细胞工程A》2023-2024学年第二学期期末试卷
- 浙江音乐学院《商务韩语应用三》2023-2024学年第二学期期末试卷
- 黄冈师范学院《剧本创作与分镜头台本》2023-2024学年第二学期期末试卷
- 2024年广东广州番禺区中医院招聘编外人员笔试高频难、易错点备考题库及参考答案详解
- 智慧医疗领域中共享知识在线教育的实践与探索
- 互动式电子白板软件行业跨境出海项目商业计划书
- 体育竞技技能提升班行业深度调研及发展项目商业计划书
- 药物供应链行业深度调研及发展项目商业计划书
- 中考物理最后一课
- 2024年四川省凉山州“千名英才.智汇凉山”行动第二批引才395人历年(高频重点复习提升训练)共500题附带答案详解
- 安徽省马鞍山市2024-2025学年高一数学下学期期末考试试题含解析
- 【解决方案】动力环境监控系统【动环监控】
- 劳务班组施工合同范本(2024版)
- 四川省眉山市2023-2024学年高一下学期期末考试英语试题(无答案)
- 北京市西城区2023-2024学年五年级下学期期末数学试卷
- 湖南建筑工程定额
- 四川省成都天府新区2024年八年级下学期末物理试题附答案
- (完整版)增值税申报表带公式模板
- 期末考试卷2《心理健康与职业生涯》(原题卷)高一思想政治课(高教版2023基础模块)
评论
0/150
提交评论