![數(shù)據(jù)庫范式習(xí)題答案_第1頁](http://file4.renrendoc.com/view/43662a2cac447900189bcaa1d1f015a2/43662a2cac447900189bcaa1d1f015a21.gif)
![數(shù)據(jù)庫范式習(xí)題答案_第2頁](http://file4.renrendoc.com/view/43662a2cac447900189bcaa1d1f015a2/43662a2cac447900189bcaa1d1f015a22.gif)
![數(shù)據(jù)庫范式習(xí)題答案_第3頁](http://file4.renrendoc.com/view/43662a2cac447900189bcaa1d1f015a2/43662a2cac447900189bcaa1d1f015a23.gif)
![數(shù)據(jù)庫范式習(xí)題答案_第4頁](http://file4.renrendoc.com/view/43662a2cac447900189bcaa1d1f015a2/43662a2cac447900189bcaa1d1f015a24.gif)
![數(shù)據(jù)庫范式習(xí)題答案_第5頁](http://file4.renrendoc.com/view/43662a2cac447900189bcaa1d1f015a2/43662a2cac447900189bcaa1d1f015a25.gif)
版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
1、 NormalizationQuestionsandAnswersDatabaseSystems,CSCI4380-01SibelAdalOctober28,2002Question1SupposeyouaregivenarelationR=(A,B,C,D,E)withthefollowingfunctionaldependencies:CEfD,DfB,CfA.Findallcandidatekeys.IdentifythebestnormalformthatRsatisfies(1NF,2NF,3NF,orBCNF).IftherelationisnotinBCNF,decomposei
2、tuntilitbecomesBCNF.Ateachstep,identifyanewrelation,decomposeandre-computethekeysandthenormalformstheysatisfy.Answer.TheonlykeyisC,ETherelationisin1NFDecomposeintoR1=(A,C)andR2=(B,C,D,E).R1isinBCNF,R2isin2NF.DecomposeR2into,R21=(C,D,E)andR22=(B,D).BothrelationsareinBCNF.Question2Supposeyouaregivenar
3、elationR=(A,B,C,D,E)withthefollowingfunctionaldependencies:BCfADE,DfB.Findallcandidatekeys.IdentifythebestnormalformthatRsatisfies(1NF,2NF,3NF,orBCNF).IftherelationisnotinBCNF,decomposeituntilitbecomesBCNF.Ateachstep,identifyanewrelation,decomposeandre-computethekeysandthenormalformstheysatisfy.Answ
4、er.ThekeysareB,CandC,DTherelationisin3NFItcannotbeputintoBCNF,evenifIremoveDandputintoarelationoftheform(B,C,D)(IneedCforthefunctionaldependency),theresultingrelationwouldnotbeinBCNF.Question3SupposeyouaregivenarelationR=(A,B,C,D,E)withthefollowingfunctionaldependencies:BDfE,AfC.Showthatthedecomposi
5、tionintoR1=(A,B,C)andR2=(D,E)islossy.Youcanshowusinganymethod.Mysuggestionistoshowhowspurioustuplesresultfromthisdecompositionwithrespecttothetablebelow:ABCDE1234518344FindasingledependencyfromasingleattributeXtoanotherattributeYsuchthatwhenyouaddthedependencyXYtotheabovedependencies,thedecompositio
6、ninpartaisnolongerlossy.Answera.Ifweweretodecomposetherelationsinto:ABCDE1234518344andthenjointhetwo(inthiscasewithacartesianproduct),wewouldget:ABCDE12345183451234418344Tuples2and3arenotintheoriginalrelation.Hence,thisdecompositionislossy.b.Thisdecompositioncannotbemadelossless.Theproblemisthereisn
7、olongerawaytomakedecompositionoftheform(A,B,C),(C,D,E)canbemadelosslessbyaddinganFDBC.sureBDEholdsacrosstworelationssincesureBDEholdsacrosstworelationssincetheydonotshareanyattributes.However,alossyQuestion4YouaregiventhefollowingsetoffunctionaldependenciesforarelationR(A,B,C,D,E,F),F=ABC,DCAE,EF.Wh
8、atarethekeysofthisrelation?IsthisrelationinBCNF?Ifnot,explainwhybyshowingoneviolation.Isthedecomposition(A,B,C,D)(B,C,D,E,F)adependencypreservingdecomposition?Ifnot,explainbriefly.Answer.Whatarethekeysofthisrelation?A,B,DandB,C,D.IsthisrelationinBCNF?Ifnot,explainwhybyshowingoneviolation.No,allfunct
9、ionaldependenciesareactuallyviolatingthis.Nodependencycontainsasuperkeyonitsleftside.Isthedecomposition(A,B,C,D)(B,C,D,E,F)adependencypreservingdecomposition?Ifnot,explainbriefly.Yes,ABCandDCAarepreservedinthefirstrelation.DCEandEFarepreservedinthesecondrelation.Question5Youaregiventhebelowfunctiona
10、ldependenciesforrelationR(A,B,C,D,E),F=ABC,ABD,DA,BCD,BCE.IsthisrelationisinBCNF?Ifnot,showalldependenciesthatviolateit.Isthisrelationin3NF?Ifnot,showalldependenciesthatviolateit.Isthefollowingdependencyimpliedbytheabovesetofdependencies?Ifso,showhowusingtheAmstrongsAxiomsgiveninthebook(p.362-363):A
11、BCtAEAnswer.Keysfortherelation:A,B,B,D,B,C.NotinBCNFsinceDtAdoeshaveasuperkeyonthelefthandside.In3NFsinceinDtA,Aispartofakey.BCtE(given)ABCtAEbytheaugmentationrule.Question6YouaregiventhetablebelowforarelationR(A,B,C,D,E).Youdonotknowthefunctionaldependenciesforthisrelation.Thisquestionisindependent
12、ofQuestion2above.ABCDEa1221s1ae2364e2ba1991b5cb2132z8dSupposethisrelationisdecomposedintothefollowingtwotables:R1(A,B,C,D)andR2(A,C,E).Isthisdecompositionlossless?Explainyourreasoning.Answer.R1R2R1R2ABCDEABCDACEa1221s1aa1221s1a1ae2364e2be2364e2e4ba1991b5ca1991b5a1cb2132z8db2132z8b2da1221s1aa1991b5cS
13、incethelasttworowsarenotintheoriginalrelation,thenthisdecompositionislossy.Question7YouaregiventhebelowsetoffunctionaldependenciesforarelationR(A,B,C,D,E,F,G),F=ADtBF,CDtEGC,BDtF,EtD,FtC,DtF.Findtheminimalcoverfortheabovesetoffunctionaldependenciesusingthealgorithmdescribedinclass.Givesufficientdeta
14、iltoshowyourreasoning,butbesuccinct.Youdonothavetolistallthecasesyoutest/considerforthealgorithm.Showallstepswhereyoumakechangestotheabovesetindetail.Usingthefunctionaldependenciesthatyoucomputedinstepa,findthekeysforthisrelation.IsitinBCNF?Explainyourreasoning.Supposewedecomposetheaboverelationinto
15、thefollowingtworelations:R1(A,B,C,D,E)R2(A,D,F,G)Usethefunctionaldependenciesintheminimalcover.Foreachrelation,writedownthefunctionaldependenciesthatfallwithinthatrelation(youcandecomposeadependencyoftheformADtBFintotwoi.e.ADtBandADtFwhencomputingthis).Usingthesefunctionaldependencies,determineifthi
16、sdecompositionislosslessand/ordependencypreserving.Explainyourreasoning.Answers.a.Step1.ADB,ADF,CDE,CDG,CDC,BDF,ED,FC,DFStep2.removeCDC,ADF,andBDF.ADB,CDE,CDG,FC,DF,EDStep3.removeDfromCDEandCDGADB,DE,DG,FC,DF,EDFinallyrecombineADB,DEGF,FC,ED.Keys:A,D,A,E.NotinBCNFsincethelastthreefunctionaldependenc
17、iesdonothaveasuperkeyonthelefthandside.R1(A,B,C,D,E)Dependencies:ADB,DE,EDR2(A,D,F,G)Dependencies:DGF.Notfunctionaldependencypreserving,thedependencyFCisnotpreserved.head(R1)Qhead(R2)=A,DR1:ADABCDEisnottruesinceCisnotimpliedbyA,DR2:ADADFGistruesincethisisimpliedbyDGFasfollows:ADADinclusionrule,since
18、DGF,usesetaccumulationrule,ADADGF.Hence,thisisalosslessdecomposition.Question8YouaregiventhefollowingsetFoffunctionaldependenciesforarelationR(A,B,C,D,E,F):F=ABCD,ABDE,CDF,CDFB,BFD.FindallkeysofRbasedonthesefunctionaldependencies.IsthisrelationinBoyce-CoddNormalForm?Isit3NF?Explainyouranswers.Canthe
19、setFbesimplified(byremovingfunctionaldependenciesorbyremovingattributesfromthelefthandsideoffunctionaldependencies)withoutchangingtheclosureofF(i.e.F+)?Hint.Considerthestepsoftheminimalcoveralgorithm.Doanyofthemapplytothisfunctionaldependency?Answer.Keys:A,B,CandA,C,DItisnotinBCNF.CounterexampleABDE
20、andABDisnotasuperkey.Itisnotin3NF.CounterexampleABDE,andABDisnotasuperkeyandEisnotprimeattribute(partofakey).LetFbeobtainedbyreplacingCDFBwithCDB.AccordingtoFandF,CD+=C,D,B,F.Hence,wecanremoveFfromthisfunctionaldependencywithoutchangingthemeaningofthesystem.Question9ConsiderrelationR(X,Y,Z).Relation
21、Rcurrentlyhasthreetuples:(6,4,2),(6,6,8)and(6,4,8).WhichofthefollowingthreefunctionaldependenciescanyouinferdonotholdforrelationR?Explainyouranswer.YXAnswer.Thefirstfunctionaldependencyholds,buttherestdonothold.Thesecondandthirdtuplesbothhave8forZbutdifferentvaluesofY.Thefirstandthirdtuplesbothhave6
22、and4forXandYbutdifferentvaluesforZ.Question10ConsidertherelationR(V,W,X,Y,Z)withfunctionaldependenciesZTY,YTZ,XTY,XTV,VWTX.ListthepossiblekeysforrelationRbasedonthefunctionaldependenciesabove.ShowtheclosureforattributeXgiventhefunctionaldependenciesabove.SupposethatrelationRisdecomposedintotworelati
23、ons,R1(V,W,X)andR2(X,Y,Z).Isthisdecompositionalosslessdecomposition?Explainyouranswer.Answer.V,W,X,WX+=X,V,Y,ZYesitislossless.Tobelosslesstheattributesincommonbetweenthetworelationsmustdeterminealltheattributesinoneofthetworelations.TheonlyattributeincommonisXanditfunctionallydeterminesalltheattribu
24、tesinR2.Question11GivenrelationR(W,X,Y,Z)andsetoffunctionaldependenciesF=XTW,WZTXY,YTWXZ.ComputetheminimalcoverforF.Answer.Step1:XTW,WZTX,WZTY,YTW,YTX,YTZStep2:DontneedWZTX,sinceWZTYandYTXDontneedYTW,sinceYTXandXTWThisleavesXTWWZTY,YTX,YTZStep3:OnlyneedtoconsiderWZTY.CanteliminateWorZ.Sonothingiseli
25、minated.Step4:XTWWZTY,YTXZistheminimalcoverQuestion12GivenrelationR(W,X,Y,Z)andsetoffunctionaldependenciesG=ZTW,YTXZ,XWTY,whereGisaminimalcover:DecomposeRintoasetofrelationsinThirdNormalForm.Isyourdecompositioninparta)alsoinBoyceCoddNormalForm?Explainyouranswer.Answer.Possiblekeys:Y,X,Z,W,XR1=(Z,W),
26、R2=(X,Y,Z),R3=(X,Y,W)Yes.Ineachofthethreerelations,theleftsideofthefuncationaldependenciesthatapplyaresuperkeysfortherelation.Hence,allthreerelationssatisfythedefinitionofBCNF.Question13ConsiderarelationnamedEMP_DEPTwithattributes:ENAME,SSN,BDATE,ADDRESS,DNUMBER,DNAME,andDMGRSSN.ConsideralsothesetGo
27、ffunctionaldependenciesforEMPDEPT:G=SSNENAMEBDATEADDRESSDNUMBER,DNUMBERDNAME,DMGRSSM.CalculatetheclosuresSSN+andDNAME+withrespecttoG.IsthesetoffunctionaldependencesGminimal?Ifnot,findaminimalsetoffunctionaldependenciesthatisequivalenttoG.ListanupdateanomalythatcanoccurforrelationEMPDEPT.ListaninsertionanomalythatcanoccurforrelationEMPDEPT.ListadeletionanomalythatcanoccurforrelationEMPDEPT.Answer.SSN+=SSN,ENAME,BDATE,ADDRESS,DNUMBER,DNAME,DMGRSSNDNAME+=DNAMEItisminimal.Sinceeverymemberofadepartmenthasareferencetothemanagerofthatdepartment(i.e.,Dmgrssn),whenthedepartmentmanager
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 住房屋租賃合同范例
- 2025年度智慧園區(qū)視頻監(jiān)控系統(tǒng)集成合同
- 農(nóng)田機(jī)器維修合同范本
- 業(yè)主物業(yè)合同范本
- 別墅石材裝修合同范本
- 凍庫合同范本
- 交通疏解合同范本
- 業(yè)務(wù)咨詢合同范本
- epc工程總承包合同范例
- 住房包工合同范本
- 物業(yè)管理服務(wù)應(yīng)急響應(yīng)方案
- 風(fēng)車的原理小班課件
- 物業(yè)保潔員勞動競賽理論知識考試題庫500題(含答案)
- 國家職業(yè)技術(shù)技能標(biāo)準(zhǔn) 4-07-07-01 洗衣師 勞社廳發(fā)20081號
- 六年級數(shù)學(xué)競賽試題及答案(六套)
- 七年級下學(xué)期數(shù)學(xué)開學(xué)第一課課件
- 臨床診療指南-口腔醫(yī)學(xué)分冊
- 《中國心血管健康與疾病報告2024》要點解讀
- 浙教版八年級下冊科學(xué)第一章 電和磁整章思維導(dǎo)圖
- 重慶建設(shè)-花籃拉桿式懸挑腳手架工藝標(biāo)準(zhǔn)(試行)
- 動物疫病傳染病防控培訓(xùn)制度
評論
0/150
提交評論