您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 人事档案/员工关系 > 数据库系统基础教程第三章答案
Exercise3.1.1Answersforthisexercisemayvarybecauseofdifferentinterpretations.SomepossibleFDs:SocialSecuritynumbernameAreacodestateStreetaddress,city,statezipcodePossiblekeys:{SocialSecuritynumber,streetaddress,city,state,areacode,phonenumber}Needstreetaddress,city,statetouniquelydeterminelocation.Apersoncouldhavemultipleaddresses.Thesameistrueforphones.Thesedays,apersoncouldhavealandlineandacellularphoneExercise3.1.2AnswersforthisexercisemayvarybecauseofdifferentinterpretationsSomepossibleFDs:IDx-position,y-position,z-positionIDx-velocity,y-velocity,z-velocityx-position,y-position,z-positionIDPossiblekeys:{ID}{x-position,y-position,z-position}Thereasonwhythepositionswouldbeakeyisnotwomoleculescanoccupythesamepoint.Exercise3.1.3aThesuperkeysareanysubsetthatcontainsA1.Thus,thereare2(n-1)suchsubsets,sinceeachofthen-1attributesA2throughAnmayindependentlybechoseninorout.Exercise3.1.3bThesuperkeysareanysubsetthatcontainsA1orA2.Thereare2(n-1)suchsubsetswhenconsideringA1andthen-1attributesA2throughAn.Thereare2(n-2)suchsubsetswhenconsideringA2andthen-2attributesA3throughAn.WedonotcountA1inthesesubsetsbecausetheyarealreadycountedinthefirstgroupofsubsets.Thetotalnumberofsubsetsis2(n-1)+2(n-2).Exercise3.1.3cThesuperkeysareanysubsetthatcontains{A1,A2}or{A3,A4}.Thereare2(n-2)suchsubsetswhenconsidering{A1,A2}andthen-2attributesA3throughAn.Thereare2(n-2)–2(n-4)suchsubsetswhenconsidering{A3,A4}andattributesA5throughAnalongwiththeindividualattributesA1andA2.Wegetthe2(n-4)termbecausewehavetodiscardthesubsetsthatcontainthekey{A1,A2}toavoiddoublecounting.Thetotalnumberofsubsetsis2(n-2)+2(n-2)–2(n-4).Exercise3.1.3dThesuperkeysareanysubsetthatcontains{A1,A2}or{A1,A3}.Thereare2(n-2)suchsubsetswhenconsidering{A1,A2}andthen-2attributesA3throughAn.Thereare2(n-3)suchsubsetswhenconsidering{A1,A3}andthen-3attributesA4throughAnWedonotcountA2inthesesubsetsbecausetheyarealreadycountedinthefirstgroupofsubsets.Thetotalnumberofsubsetsis2(n-2)+2(n-3).Exercise3.2.1aWecouldtryinferencerulestodeducenewdependenciesuntilwearesatisfiedwehavethemall.Amoresystematicwayistoconsidertheclosuresofall15nonemptysetsofattributes.Forthesingleattributeswehave{A}+=A,{B}+=B,{C}+=ACD,and{D}+=AD.Thus,theonlynewdependencywegetwithasingleattributeontheleftisCA.Nowconsiderpairsofattributes:{AB}+=ABCD,sowegetnewdependencyABD.{AC}+=ACD,andACDisnontrivial.{AD}+=AD,sonothingnew.{BC}+=ABCD,sowegetBCA,andBCD.{BD}+=ABCD,givingusBDAandBDC.{CD}+=ACD,givingCDA.Forthetriplesofattributes,{ACD}+=ACD,buttheclosuresoftheothersetsareeachABCD.Thus,wegetnewdependenciesABCD,ABDC,andBCDA.Since{ABCD}+=ABCD,wegetnonewdependencies.Thecollectionof11newdependenciesmentionedaboveare:CA,ABD,ACD,BCA,BCD,BDA,BDC,CDA,ABCD,ABDC,andBCDA.Exercise3.2.1bFromtheanalysisofclosuresabove,wefindthatAB,BC,andBDarekeys.AllothersetseitherdonothaveABCDastheclosureorcontainoneofthesethreesets.Exercise3.2.1cThesuperkeysareallthosethatcontainoneofthosethreekeys.Thatis,asuperkeythatisnotakeymustcontainBandmorethanoneofA,C,andD.Thus,the(proper)superkeysareABC,ABD,BCD,andABCD.Exercise3.2.2ai)Forthesingleattributeswehave{A}+=ABCD,{B}+=BCD,{C}+=C,and{D}+=D.Thus,thenewdependenciesareACandAD.Nowconsiderpairsofattributes:{AB}+=ABCD,{AC}+=ABCD,{AD}+=ABCD,{BC}+=BCD,{BD}+=BCD,{CD}+=CD.ThusthenewdependenciesareABC,ABD,ACB,ACD,ADB,ADC,BCDandBDC.Forthetriplesofattributes,{BCD}+=BCD,buttheclosuresoftheothersetsareeachABCD.Thus,wegetnewdependenciesABCD,ABDC,andACDB.Since{ABCD}+=ABCD,wegetnonewdependencies.Thecollectionof13newdependenciesmentionedaboveare:AC,AD,ABC,ABD,ACB,ACD,ADB,ADC,BCD,BDC,ABCD,ABDCandACDB.ii)Forthesingleattributeswehave{A}+=A,{B}+=B,{C}+=C,and{D}+=D.Thus,therearenonewdependencies.Nowconsiderpairsofattributes:{AB}+=ABCD,{AC}+=AC,{AD}+=ABCD,{BC}+=ABCD,{BD}+=BD,{CD}+=ABCD.ThusthenewdependenciesareABD,ADC,BCAandCDB.Forthetriplesofattributes,alltheclosuresofthesetsareeachABCD.Thus,wegetnewdependenciesABCD,ABDC,ACDBandBCDA.Since{ABCD}+=ABCD,wegetnonewdependencies.Thecollectionof8newdependenciesmentionedaboveare:ABD,ADC,BCA,CDB,ABCD,ABDC,ACDBandBCDA.iii)Forthesingleattributeswehave{A}+=ABCD,{B}+=ABCD,{C}+=ABCD,and{D}+=ABCD.Thus,thenewdependenciesareAC,AD,BD,BA,CA,CB,DBandDC.Sinceallthesingleattributes’closuresareABCD,anysupersetofthesingleattributeswillalsoleadtoaclosureofABCD.Knowingthis,wecanenumeratetherestofthenewdependencies.Thecollectionof24newdependenciesmentionedaboveare:AC,AD,BD,BA,CA,CB,DB,DC,ABC,ABD,ACB,ACD,ADB,ADC,BCA,BCD,BDA,BDC,CDA,CDB,ABCD,ABDC,ACDBandBCDA.Exercise3.2.2bi)Fromtheanalysisofclosuresin3.2.2a(i),wefindthattheonlykeyisA.AllothersetseitherdonothaveABCDastheclosureorcontainA.ii)Fromtheanalysisofclosures3.2.2a(ii),wefindthatAB,AD,BC,andCDarekeys.AllothersetseitherdonothaveABCDastheclosureorcontainoneofthesefoursets.iii)Fromtheanalysisofclosures3.2.2a(iii),wefindthatA,B,CandDarekeys.AllothersetseitherdonothaveABCDastheclosureorcontainoneofthesefoursets.Exercise3.2.2ci)Thesuperkeysareallthoseset
本文标题:数据库系统基础教程第三章答案
链接地址:https://www.777doc.com/doc-5588353 .html