數(shù)據(jù)庫系統(tǒng)基礎(chǔ)教程第三章答案_第1頁
數(shù)據(jù)庫系統(tǒng)基礎(chǔ)教程第三章答案_第2頁
數(shù)據(jù)庫系統(tǒng)基礎(chǔ)教程第三章答案_第3頁
數(shù)據(jù)庫系統(tǒng)基礎(chǔ)教程第三章答案_第4頁
數(shù)據(jù)庫系統(tǒng)基礎(chǔ)教程第三章答案_第5頁
已閱讀5頁,還剩27頁未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

Exercise3.1.1Answersforthisexercisemayvarybecauseofdifferentinterpretations.SomepossibleFDs: SocialSecuritynumbername Areacodestate Streetaddress,city,statezipcodePossiblekeys: {SocialSecuritynumber,streetaddress,city,state,areacode,phonenumber}Needstreetaddress,city,statetouniquelydeterminelocation.Apersoncouldhavemultipleaddresses.Thesameistrueforphones.Thesedays,apersoncouldhavealandlineandacellularphoneExercise3.1.2AnswersforthisexercisemayvarybecauseofdifferentinterpretationsSomepossibleFDs: IDx-position,y-position,z-position IDx-velocity,y-velocity,z-velocity x-position,y-position,z-positionIDPossiblekeys: {ID} {x-position,y-position,z-position}Thereasonwhythepositionswouldbeakeyisnotwomoleculescanoccupythesamepoint.Exercise3.ThesuperkeysareanysubsetthatcontainsA1.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.Thesuperkeysareanysubsetthatcontains{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.Wecouldtryinferencerulestodeducenewdependenciesuntilwearesatisfiedwehavethemall.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.Thesuperkeysareallthosethatcontainoneofthosethreekeys.Thatis,asuperkeythatisnotakeymustcontainBandmorethanoneofA,C,andD.Thus,the(proper)superkeysareABC,ABD,BCD,andABCD.Exercise3.i)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.2aii)Fromtheanalysisofclosures3.2.2aiii)Fromtheanalysisofclosures3.2.2aExercise3.i)Thesuperkeysareallthosesetsthatcontainoneofthekeysin3.2.2b(i).ThesuperkeysareAB,AC,AD,ABC,ABD,ACD,BCDandABCD.ii)Thesuperkeysareallthosesetsthatcontainoneofthekeysin3.2.2b(ii).ThesuperkeysareABC,ABD,ACD,BCDandABCD.iii)Thesuperkeysareallthosesetsthatcontainoneofthekeysin3.2.2b(iii).ThesuperkeysareAB,AC,AD,BC,BD,CD,ABC,ABD,ACD,BCDandABCD.Exercise3.SinceA1A2…AnCcontainsA1A2…An,thentheclosureofA1A2…AnCcontainsB.ThusitfollowsthatA1A2…AExercise3.2.3bFrom3.2.3a,weknowthatA1A2…AnCB.Usingtheconceptoftrivialdependencies,wecanshowthatA1A2…AnCC.ThusA1AExercise3.FromA1A2…AnE1E2…Ej,weknowthattheclosurecontainsB1B2…BmbecauseoftheFDA1A2…AnB1B2…Bm.TheB1B2…BmandtheE1E2…EjcombinetoformtheC1C2…Ck.ThustheclosureofA1A2…AnE1E2…EjcontainsDaswell.Thus,A1A2…AnE1E2Exercise3.2.3dFromA1A2…AnC1C2…Ck,weknowthattheclosurecontainsB1B2…BmbecauseoftheFDA1A2…AnB1B2…Bm.TheC1C2…CkalsotellusthattheclosureofA1A2…AnC1C2…CkcontainsD1D2…Dj.Thus,A1A2…AnC1C2…CkB1B2…BkExercise3.IfattributeArepresentedSocialSecurityNumberandBrepresentedaperson’sname,thenwewouldassumeABbutBAwouldnotbevalidbecausetheremaybemanypeoplewiththesamenameanddifferentSocialSecurityNumbers.Exercise3.2.4bLetattributeArepresentSocialSecurityNumber,BrepresentgenderandCrepresentname.SurelySocialSecurityNumberandgendercanuniquelyidentifyaperson’sname(i.e.ABC).ASocialSecurityNumbercanalsouniquelyidentifyaperson’sname(i.e.AC).However,genderdoesnotuniquelydetermineaname(i.e.BCisnotvalid).Exercise3.LetattributeArepresentlatitudeandBrepresentlongitude.Together,bothattributescanuniquelydetermineC,apointontheworldmap(i.e.ABC).However,neitherAnorBcanuniquelyidentifyapoint(i.e.ACandBCarenotvalid).Exercise3.2.5GivenarelationwithattributesA1A2…An,wearetoldthattherearenofunctionaldependenciesoftheformB1B2…Bn-1CwhereB1B2…Bn-1isn-1oftheattributesfromA1A2…AnandCistheremainingattributefromA1A2…An.Inthiscase,thesetB1B2…Bn-1andanysubsetdonotfunctionallydetermineC.ThusExercise3.2.6Let’sprovethisbyusingthecontrapositive.WewishtoshowthatifX+isnotasubsetofY+,thenitmustbethatXisnotasubsetofY.IfX+isnotasubsetofY+,theremustbeattributesA1A2…AninX+thatarenotinY+.IfanyoftheseattributeswereoriginallyinX,thenwearedonebecauseYdoesnotcontainanyoftheA1A2…An.However,iftheA1A2…Anwereaddedbytheclosure,thenwemustexaminethecasefurther.AssumethattherewassomeFDC1C2…CmA1A2…AjwhereA1A2…AjissomesubsetofA1A2…An.ItmustbethenthatC1C2…CmorsomesubsetofC1C2…CmisinX.However,theattributesC1C2…CmcannotbeinYbecauseweassumedthatattributesAByprovingthecontrapositive,wehavealsoprovedifX?Y,thenX+?Y+.Exercise3.2.7ThealgorithmtofindX+isoutlinedonpg.76.Usingthatalgorithm,wecanprovethat(X+)+=X+.Wewilldothisbyusingaproofbycontradiction.Supposethat(X+)+≠X+.Thenfor(X+)+,itmustbethatsomeFDallowedadditionalattributestobeaddedtotheoriginalsetX+.Forexample,X+AwhereAissomeattributenotinX+.However,ifthiswerethecase,thenX+wouldnotbetheclosureofX.TheclosureofXwouldhavetoincludeAaswell.ThiscontradictsthefactthatweweregiventheclosureofX,X+.Therefore,itmustbethat(X+)+=X+orelseX+isnottheclosureofX.Exercise3.Ifallsetsofattributesareclosed,thentherecannotbeanynontrivialfunctionaldependencies.SupposeA1A2...AnBisanontrivialdependency.Then{A1A2...An}+containsBandthusA1A2Exercise3.2.8bIftheonlyclosedsetsare?and{A,B,C,D},thenthefollowingFDshold:AB AC ADBA BC BDCA CB CDDA DB DCABC ABDACB ACDADB ADCBCA BCDBDA BDCCDA CDBABCDABDCACDBBCDAExercise3.Iftheonlyclosedsetsare?,{A,B}and{A,B,C,D},thenthefollowingFDshold:ABBACA CB CDDA DB DCACB ACDADB ADCBCA BCDBDA BDCCDA CDBABCDABDCACDBBCDAExercise3.2.9WecanthinkofthisproblemasasituationwheretheattributesA,B,Crepresentcitiesandthefunctionaldependenciesrepresentonewaypathsbetweenthecities.Theminimalbasesaretheminimalnumberofpathwaysthatareneededtoconnectthecities.Wedonotwanttocreateanotherroadwayifthetwocitiesarealreadyconnected.Thesystematicwaytodothiswouldbetocheckallpossiblesetsofthepathways.However,wecansimplifythesituationbynotingthatittakesmorethantwopathwaystovisitthetwoothercitiesandcomeback.Also,ifwefindasetofpathwaysthatisminimal,addingadditionalpathwayswillnotcreateanotherminimalset.Thetwosetsofminimalbasesthatweregiveninexample3.11are:{AB,BC,CA}{AB,BA,BC,CB}Theadditionalsetsofminimalbasesare:{CB,BA,AC}{AB,AC,BA,CA}{AC,BC,CA,CB}Exercise3.Weneedtocomputetheclosuresofallsubsetsof{ABC},althoughthereisnoneedtothinkabouttheemptysetorthesetofallthreeattributes.Herearethecalculationsfortheremainingsixsets:{A}+=A{B}+=B{C}+=ACE{AB}+=ABCDE{AC}+=ACE{BC}+=ABCDEWeignoreDandE,soabasisfortheresultingfunctionaldependenciesforABCis:CAandABC.NotethatBC->Aistrue,butfollowslogicallyfromC->A,andthereforemaybeomittedfromourlist.Exercise3.2.10bWeneedtocomputetheclosuresofallsubsetsof{ABC},althoughthereisnoneedtothinkabouttheemptysetorthesetofallthreeattributes.Herearethecalculationsfortheremainingsixsets:{A}+=AD{B}+=B{C}+=C{AB}+=ABDE{AC}+=ABCDE{BC}+=BCWeignoreDandE,soabasisfortheresultingfunctionaldependenciesforABCis:ACB.Exercise3.Weneedtocomputetheclosuresofallsubsetsof{ABC},althoughthereisnoneedtothinkabouttheemptysetorthesetofallthreeattributes.Herearethecalculationsfortheremainingsixsets:{A}+=A{B}+=B{C}+=C{AB}+=ABD{AC}+=ABCDE{BC}+=ABCDEWeignoreDandE,soabasisfortheresultingfunctionaldependenciesforABCis:ACBandBCA.Exercise3.2.10dWeneedtocomputetheclosuresofallsubsetsof{ABC},althoughthereisnoneedtothinkabouttheemptysetorthesetofallthreeattributes.Herearethecalculationsfortheremainingsixsets:{A}+=ABCDE{B}+=ABCDE{C}+=ABCDE{AB}+=ABCDE{AC}+=ABCDE{BC}+=ABCDEWeignoreDandE,soabasisfortheresultingfunctionaldependenciesforABCis:AB,BCandCA.Exercise3.2.11ForsteponeofAlgorithm3.7,supposewehavetheFDABCDE.WewanttouseArmstrong’sAxiomstoshowthatABCDandABCEfollow.SurelythefunctionaldependenciesDEDandDEEholdbecausetheyaretrivialandfollowthereflexivityproperty.Usingthetransitivityrule,wecanderivetheFDABCDfromtheFDsABCDEandDED.Likewise,wecandothesameforABCForstepstwothroughfourofAlgorithm3.7,supposewehavetheinitialsetofattributesoftheclosureasABC.SupposealsothatwehaveFDsCDandDE.AccordingtoAlgorithm3.7,theclosureshouldbecomeABCDE.TakingtheFDCDandaugmentingbothsideswithattributesABwegettheFDABCABD.WecanusethesplittingmethodinsteponetogettheFDABCD.SinceDisnotintheclosure,wecanaddattributeD.TakingtheFDDEandaugmentingbothsideswithattributesABCwegettheFDABCDABCDE.UsingagainthesplittingmethodinsteponewegettheFDABCDE.SinceEisnotintheclosure,wecanaddattributeE.GivenasetofFDs,wecanprovethataFDFfollowsbytakingtheclosureoftheleftsideofFDF.ThestepstocomputetheclosureinAlgorithm3.7canbemimickedbyArmstrong’saxiomsandthuswecanproveFfromthegivensetofFDsusingArmstrong’saxioms.Exercise3.InthesolutiontoExercise3.2.1wefoundthatthereare14nontrivialdependencies,includingthethreegivenonesandelevenderiveddependencies.Theyare:CA,CD,DA,ABD,ABC,ACD,BCA,BCD,BDA,BDC,CDA,ABCD,ABDC,andBCDA.WealsolearnedthatthethreekeyswereAB,BC,andBD.Thus,anydependencyabovethatdoesnothaveoneofthesepairsontheleftisaBCNFviolation.Theseare:CA,CD,DA,ACD,andCDA.OnechoiceistodecomposeusingtheviolationCD.UsingtheaboveFDs,wegetACDandBCasdecomposedrelations.BCissurelyinBCNF,sinceanytwo-attributerelationis.UsingAlgorithm3.12todiscovertheprojectionofFDsonrelationACD,wediscoverthatACDisnotinBCNFsinceCisitsonlykey.However,DAisadependencythatholdsinABCDandthereforeholdsinACD.WemustfurtherdecomposeACDintoADandCD.Thus,thethreerelationsofthedecompositionareBC,AD,andCD.Exercise3.3.1bBycomputingtheclosuresofall15nonemptysubsetsofABCD,wecanfindallthenontrivialFDs.TheyareBC,BD,ABC,ABD,BCD,BDC,ABCDandABDC.FromtheclosureswecanalsodeducethattheonlykeyisAB.Thus,anydependencyabovethatdoesnotcontainABontheleftisaBCNFviolation.Theseare:BC,BD,BCDandBDC.OnechoiceistodecomposeusingtheviolationBC.UsingtheaboveFDs,wegetBCDandABasdecomposedrelations.ABissurelyinBCNF,sinceanytwo-attributerelationis.UsingAlgorithm3.12todiscovertheprojectionofFDsonrelationBCD,wediscoverthatBCDisinBCNFsinceBisitsonlykeyandtheprojectedFDsallhaveBontheleftside.ThusthetworelationsofthedecompositionareABandBCD.Exercise3.InthesolutiontoExercise3.2.2(ii),wefoundthatthereare12nontrivialdependencies,includingthefourgivenonesandtheeightderivedones.TheyareABC,BCD,CDA,ADB,ABD,ADC,BCA,CDB,ABCD,ABDC,ACDBandBCDA.WealsofoundoutthatthekeysareAB,AD,BC,andCD.Thus,anydependencyabovethatdoesnothaveoneofthesepairsontheleftisaBCNFviolation.However,alloftheFDscontainakeyontheleftsotherearenoBCNFviolations.NodecompositionisnecessarysincealltheFDsdonotviolateBCNF.Exercise3.3.1dInthesolutiontoExercise3.2.2(iii),wefoundthatthereare28nontrivialdependencies,includingthefourgivenonesandthe24derivedones.TheyareAB,BC,CD,DA,AC,AD,BD,BA,CA,CB,DB,DC,ABC,ABD,ACB,ACD,ADB,ADC,BCA,BCD,BDA,BDC,CDA,CDB,ABCD,ABDC,ACDBandBCDA.WealsofoundoutthatthekeysareA,B,C,D.Thus,anydependencyabovethatdoesnothaveoneoftheseattributesontheleftisaBCNFviolation.However,alloftheFDscontainakeyontheleftsotherearenoBCNFviolations.NodecompositionisnecessarysincealltheFDsdonotviolateBCNF.Exercise3.3.1eBycomputingtheclosuresofall31nonemptysubsetsofABCDE,wecanfindallthenontrivialFDs.TheyareABC,DEC,BD,ABD,BCD,BEC,BED,ABCD,ABDC,ABEC,ABED,ADEC,BCED,BDEC,ABCED,andABDEC.FromtheclosureswecanalsodeducethattheonlykeyisABE.Thus,anydependencyabovethatdoesnotcontainABEontheleftisaBCNFviolation.Theseare:ABC,DEC,BD,ABD,BCD,BEC,BED,ABCD,ABDC,ADEC,BCEDandBDEC.OnechoiceistodecomposeusingtheviolationABC.UsingtheaboveFDs,wegetABCDandABEasdecomposedrelations.UsingAlgorithm3.12todiscovertheprojectionofFDsonrelationABCD,wediscoverthatABCDisnotinBCNFsinceABisitsonlykeyandtheFDBDfollowsforABCD.UsingviolationBDtofurtherdecompose,wegetBDandABCasdecomposedrelations.BDisinBCNFbecauseitisatwo-attributerelation.UsingAlgorithm3.12again,wediscoverthatABCisinBCNFsinceABistheonlykeyandABCistheonlynontrivialFD.GoingbacktorelationABE,followingAlgorithm3.12tellsusthatABEisinBCNFbecausetherearenokeysandnonontrivialFDs.ThusthethreerelationsofthedecompositionareABC,BDandABE.Exercise3.Bycomputingtheclosuresofall31nonemptysubsetsofABCDE,wecanfindallthenontrivialFDs.Theyare:CB,CD,CE,DB,DE,ABC,ABD,ABE,ACB,ACD,ACE,ADB,ADC,ADE,BCD,BCE,BDE,CDB,CDE,CEB,CED,DEB,ABCD,ABCE,ABDC,ABDE,ABEC,ABED,ACDB,ACDE,ACEB,ACED,ADEB,ADEC,BCDE,BCED,CDEB,ABCDE,ABCED,ABDECandACDEB.FromtheclosureswecanalsodeducethatthekeysareAB,ACandAD.Thus,anydependencyabovethatdoesnotcontainoneoftheabovepairsontheleftisaBCNFviolation.Theseare:CB,CD,CE,DB,DE,BCD,BCE,BDE,CDB,CDE,CEB,CED,DEB,BCDE,BCEDandCDEB.OnechoiceistodecomposeusingtheviolationDB.UsingtheaboveFDs,wegetBDEandABCasdecomposedrelations.UsingAlgorithm3.12todiscovertheprojectionofFDsonrelationBDE,wediscoverthatBDEisinBCNFsinceD,BD,DEaretheonlykeysandalltheprojectedFDscontainD,BD,orDEintheleftside.GoingbacktorelationABC,followingAlgorithm3.12tellsusthatABCisnotinBCNFbecausesinceABandACareitsonlykeysandtheFDCBfollowsforABC.UsingviolationCBtofurtherdecompose,wegetBCandACasdecomposedrelations.BothBCandACareinBCNFbecausetheyaretwo-attributerelations.ThusthethreerelationsofthedecompositionareBDE,Exercise3.3.2Yes,wewillgetthesameresult.BothABandABChaveAontheleftsideandpartoftheprocessofdecompositioninvolvesfinding{A}+toformonedecomposedrelationandAplustherestoftheattributesnotin{A}+asthesecondrelation.Bothcasesyieldthesamedecomposedrelations.Exercise3.3.3Yes,wewillstillgetthesameresult.BothABandABChaveAontheleftsideandpartoftheprocessofdecompositioninvolvesfinding{A}+toformonedecomposedrelationandAplustherestoftheattributesnotin{A}+asthesecondrelation.Bothcasesyieldthesamedecomposedrelations.Exercise3.3.4ThisistakenfromExample3.21pg.95.SupposethataninstanceofrelationRonlycontainstwotuples.ABC123425TheprojectionsofRontotherelationswithschemas{A,B}and{B,C}are:AB1242BC2325Ifwedoanaturaljoinonthetwoprojections,wewillget:ABC123125423425TheresultofthenaturaljoinisnotequaltotheoriginalrelationR.Exercise3.Thisistheinitialtableau:ABCDEabcd1e1a1bcde1ab1cd1eThisisthefinaltableauafterapplyingFDsBEandCEA.ABCDEabcd1e1abcde1ab1cd1eSincethereisnotanunsubscriptedrow,thedecompositionforRisnotlosslessforthissetofFDs.WecanusethefinaltableauasaninstanceofRasanexampleforwhythejoinisnotlossless.Theprojectedrelationsare:ABCabcab1cBCDbcd1bcdb1cd1ACEace1aceThejoinedrelationis:ABCDEabcd1e1abcde1ab1cd1e1abcd1eabcdeab1cd1eThejoinedrelationhasthreemoretuplesthantheoriginaltableau.Exercise3.4.1bThisistheinitialtableau:ABCDEabcd1e1a1bcde1ab1cd1eThisisthefinaltableauafterapplyingFDsACEandBCDABCDEabcdea1bcde1ab1cd1eSincethereisanunsubscriptedrow,thedecompositionforRislosslessforthissetofFDs.Exercise3.Thisistheinitialtableau:ABCDEabcd1e1a1bcde1ab1cd1eThisisthefinaltableauafterapplyingFDsAD,DEandBD.ABCDEabcdea1bcdeab1cdeSincethereisanunsubscriptedrow,thedecompositionforRislosslessforthissetofFDs.Exercise3.4.1dThisistheinitialtableau:ABCDEabcd1e1a1bcde1ab1cd1eThisisthefinaltableauafterapplyingFDsAD,CDEandEDABCDEabcdea1bcdeab1cdeSincethereisanunsubscriptedrow,thedecompositionforRislosslessforthissetofFDs.Exercise3.4.2WhenwedecomposearelationintoBCNF,wewillprojecttheFDsontothedecomposedrelationstogetnewsetsofFDs.ThesedependenciesarepreservediftheunionofthesenewsetsisequivalenttotheoriginalsetofFDs.FortheFDsof3.4.1a,thedependenciesarenotpreserved.TheunionofthenewsetsofFDsisCEA.However,theFDBEisnotintheunionandcannotbederived.ThusthetwosetsofFDsarenotequivalent.FortheFDsof3.4.1b,thedependenciesarepreserved.TheunionofthenewsetsofFDsisACEandBCD.ThisispreciselythesameastheoriginalsetofFDsandthusthetwosetsofFDsareequivalent.FortheFDsof3.4.1c,thedependenciesarenotpreserved.TheunionofthenewsetsofFDsisBDandAE.TheFDsADandDEarenotintheunionandcannotbederived.ThusthetwosetsofFDsarenotequivalent.FortheFDsof3.4.1d,thedependenciesarenotpreserved.TheunionofthenewsetsofFDsisACE.However,theFDsAD,CDEandEDarenotintheunionandcannotbederived.ThusthetwosetsofFDsarenotequivalent.Exercise3.5.1aInthesolutiontoExercise3.3.1awefoundthatthereare14nontrivialdependencies.Theyare:CA,CD,DA,ABD,ABC,ACD,BCA,BCD,BDA,BDC,CDA,ABCD,ABDC,andBCDA.WealsolearnedthatthethreekeyswereAB,BC,andBD.SincealltheattributesontherightsidesoftheFDsareprime,thereareno3NFviolations.Sincethereareno3NFviolations,itisnotnecessarytodecomposetherelation.Exercise3.5.1bInthesolutiontoExercise3.3.1bwefoundthatthereare8nontrivialdependencies.TheyareBC,BD,ABC,ABD,BCD,BDC,ABCDandABDC.WealsofoundoutthattheonlykeyisAB.FDswheretheleftsideisnotasuperkeyortheattributesontherightarenotpartofsomekeyare3NFviolations.The3NFviolationsareBC,BD,BCDandBDC.Usingalgorithm3.26,wecandecomposeintorelationsusingtheminimalbasisBCandBD.TheresultingdecomposedrelationswouldbeBCandBD.However,noneofthesetwosetsofattributesisasuperkey.ThusweaddrelationABtotheresult.ThefinalsetofdecomposedrelationsisBC,BDandAB.Exercise3.5.1cInthesolutiontoExercise3.3.1cwefoundthatthereare12nontrivialdependencies.TheyareABC,BCD,CDA,ADB,ABD,ADC,BCA,CDB,ABCD,ABDC,ACDBandBCDA.WealsofoundoutthatthekeysareAB,AD,BC,andCD.SincealltheattributesontherightsidesoftheFDsareprime,thereareno3NFviolations.Sincethereareno3NFviolations,itisnotnecessarytodecomposetherelation.Exercise3.5.1dInthesolutiontoExercise3.3.1dwefoundthatthereare28nontrivialdependencies.TheyareAB,BC,CD,DA,AC,AD,BD,BA,CA,CB,DB,DC,ABC,ABD,ACB,ACD,ADB,ADC,BCA,BCD,BDA,BDC,CDA,CDB,ABCD,ABDC,ACDBandBCDA.WealsofoundoutthatthekeysareA,B,C,D.SincealltheattributesontherightsidesoftheFDsareprime,thereareno3NFviolations.Sincethereareno3NFviolations,itisnotnecessarytodecomposetherelation.Exercise3.5.1eInthesolutiontoExercise3.3.1ewefoundthatthereare16nontrivialdependencies.TheyareABC,DEC,BD,ABD,BCD,BEC,BED,ABCD,ABDC,ABEC,ABED,ADEC,BCED,BDEC,ABCED,andABDEC.WealsofoundoutthattheonlykeyisABE.FDswheretheleftsideisnotasuperkeyortheattributesontherightarenotpartofsomekeyare3NFviolations.The3NFviolationsareABC,DEC,BD,ABD,BCD,BEC,BED,ABCD,ABDC,ADEC,BCEDandBDEC.Usingalgorithm3.26,wecandecomposeintorelationsusingtheminimalbasisABC,DECandBD.TheresultingdecomposedrelationswouldbeABC,CDEandBD.However,noneofthesethreesetsofattributesisasuperkey.ThusweaddrelationABEtotheresult.ThefinalsetofdecomposedrelationsisABC,CDE,BDandABE.Exercise3.5.1fInthesolutiontoExercise3.3.1fwefoundthatthereare41nontrivialdependencies.Theyare:CB,CD,CE,DB,DE,ABC,ABD,ABE,ACB,ACD,ACE,ADB,ADC,ADE,BCD,BCE,BDE,CDB,CDE,CEB,CED,DEB,ABCD,ABCE,ABDC,ABDE,ABEC,ABED,ACDB,ACDE,ACEB,ACED,ADEB,ADEC,BCDE,BCED,CDEB,ABCDE,ABCED,ABDECandACDEB.WealsofoundoutthatthekeysareAB,ACandAD.FDswheretheleftsideisnotasuperkeyortheattributesontherightarenotpartofsomekeyare3NFviolations.The3NFviolationsareCE,DE,BCE,BDE,CDUsingalgorithm3.26,wecandecomposeintorelationsusingtheminimalbasisABC,CD,DBandDE.TheresultingdecomposedrelationswouldbeABC,CD,BDandDE.SincerelationABCcontainsakey,wecanstopwiththedecomposition.ThefinalsetofdecomposedrelationsisABC,CD,BDandDE.Exercise3.5.2aTheusualproceduretofindthekeyswouldbetotaketheclosureofall63nonemptysubsets.However,ifwenoticethatnoneoftherightsidesoftheFDscontainsattributesHandS.ThusweknowthatattributesHandSmustbepartofanykey.WeeventuallywillfindoutthatHSistheonlykeyfortheCoursesrelation.Exercise3.5.2bThefirststeptoverifythatthegivenFDsaretheirownminimalbasisistochecktoseeifanyoftheFDscanberemoved.However,ifweremoveanyoneofthefiveFDs,theremainingfourFDsdonotimplytheremovedFD.ThesecondsteptoverifythatthegivenFDsaretheirownminimalbasisistochecktoseeifanyoftheleftsidesofanFDcanhaveoneormoreattributesremovedwithoutlosingthedependencies.However,thisisnotthecaseforthefourFDsthatcontaintwoattributesontheleftside.Thus,thegivensetofFDshasbeenverifiedtobetheminimalbasis.Exercise3.5.2cSincetheonlykeyisHS,thegivensetofFDshassomedependenciesthatviolate3NF.WealsoknowthatthegivensetofFDsisaminimalbasis.ThusthedecomposedrelationsareCT,HRC,HTR,HSRandCSG.SincetherelationHSRcontainsakey,wedonotneedtoaddanadditionalrelation.ThefinalsetofdecomposedrelationsisCT,HRC,HTR,HSRandCSG.NoneofthedecomposedrelationsviolateBCNF.ThiscanbeverifiedbyprojectingthegivensetofFDsontoeachofthedeco

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論