版權(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)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 二零二五年度手機(jī)屏幕保護(hù)膜定制施工合同
- 2025年度個人對個人房產(chǎn)抵押借款合同3篇
- 2025版養(yǎng)老服務(wù)機(jī)構(gòu)投資管理合同范本4篇
- 2025年度影視廣告拍攝合同范本3篇
- 2025年度個人租賃戶外活動場地合同范本3篇
- 二零二五年度牛奶冷鏈物流配送合同模板4篇
- 2025版政府機(jī)關(guān)辦公計算機(jī)統(tǒng)一采購合同3篇
- 2025年度新型門窗材料采購安裝及技術(shù)研發(fā)合同4篇
- 2025年度智慧城市排水系統(tǒng)升級改造分項合同范本4篇
- 2025年度土地租賃合同中合同解除與違約責(zé)任規(guī)定
- 2023-2024學(xué)年西安市高二數(shù)學(xué)第一學(xué)期期末考試卷附答案解析
- 部編版二年級下冊道德與法治第三單元《綠色小衛(wèi)士》全部教案
- 【京東倉庫出庫作業(yè)優(yōu)化設(shè)計13000字(論文)】
- 保安春節(jié)安全生產(chǎn)培訓(xùn)
- 初一語文上冊基礎(chǔ)知識訓(xùn)練及答案(5篇)
- 初中班級成績分析課件
- 勞務(wù)合同樣本下載
- 血液透析水處理系統(tǒng)演示
- GB/T 27030-2006合格評定第三方符合性標(biāo)志的通用要求
- GB/T 13663.2-2018給水用聚乙烯(PE)管道系統(tǒng)第2部分:管材
- 同角三角函數(shù)的基本關(guān)系式同步練習(xí)
評論
0/150
提交評論