




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、中山大學(xué)軟件學(xué)院2010級(jí)軟件工程專業(yè)(2011春天學(xué)期)SE-304數(shù)據(jù)庫系統(tǒng)期末試題答案(A)(考試形式:開卷考試時(shí)間:2小時(shí))中山大學(xué)授與學(xué)士學(xué)位工作細(xì)則第六條考試舞弊不授與學(xué)士學(xué)位方向:姓名:學(xué)號(hào):出卷:馮劍琳、鄭貴鋒審查:注意:答案必定要寫在答卷中,寫在本試題卷中不給分。本試卷要和答卷一同交回。Question1.(20marks)Assumeasimplecaseofnon-1NFrelationsdefinedasfollows:allvaluesarenon-emptysetsofintegers.Forexample,thefollowingisaschemaofA,B,Ca
2、ndD.ABCD1,22,41,21,42,34,52,32,31,31,32,32,3SupposeanFDXY(XandYaresetsofattributes)isnewlydefinedasfollows:anypairoftuplest1andt2,ifforallattributesAinX,t1Aandt2Ahavecommonelements(假如全部下性均有公共元素)thenthereexistsanattributeBinYsuchthatt1Bandt2Bhavecommonelements.Forexample,wehaveACintheabovetablebutnot
3、AB.舉例來說,1,22,41,21,4這一行就是一個(gè)tuple,1,2是一個(gè)attribute,1,2里面的1和2就是兩個(gè)elements。ABCD1,22,41,21,42,34,52,32,31,31,32,32,3(i)(5marks)Proveordisproveifdecompositionrule(IfXYZ,thenXYandXZ)ofFDsholdsinthenewsetting.分解定律不建立。在題目所給的例子中,ABC建立,AC也建立,但AB不建立。再看另一個(gè)例子。這個(gè)例子中ABC建立,AB也建立。但AC不建立.ABCD11111122第1頁,共6頁(ii)(5marks
4、)Proveordisproveiftransitivityrule(IfXYandYZ,thenXZ)ofFDsholdsinthenewsetting.傳達(dá)律不建立。反比以下:ABCD11111122ABC和BCD均建立??墒茿D不建立。(BCD建立的原由可由“包含a=b中若a為假,則a=b為真”推出)(iii)(10marks)Proveordisproveifunionrule(IfXYandXZ,thenXYZ)ofFDsholdsintheabovesetting.標(biāo)準(zhǔn)答案:Unionruleholds.Toproveunionrule:IfXYandXZ,thenXYZForan
5、ytwotuplest1andt2,suchthatt1Aforallt2AinXSinceXYholds,wehavet1At2AforsomeAinY.AisinYZandthusXYZalsoholds.由于XY,因此關(guān)于X里面的全部下性,它們都有公共元素;且關(guān)于Y里面存在某些屬性擁有公共元素。同原由于XZ,因此關(guān)于X里面的全部下性,它們都有公共元素;且對(duì)于Z里面存在某些屬性擁有公共元素。因此我們能夠得出結(jié)論:“關(guān)于X里面的全部下性,它們都有公共元素;關(guān)于YZ里面存在某些屬性互相之間是有公共元素的”,這就能夠推出XYZ了。Question2.(20marks)Considerconstr
6、uctingaB+treeoforderd=1(i.e.,everynodecontainsmentries,whered=m=2d).(a)(10marks)Showtheresultingtreeafterinsertingkeys10,20,30,40,50,60inthisorder,onebyone.Drawtheinitialtreeandthetreesaftereverynodesplit.(初始樹、每次節(jié)點(diǎn)分裂后的樹).(b)(10marks)Isitpossible,withthesamesetofkeys,toconstructai.e.,“shorter”treeone
7、thathasasmallerheight?Ifno,explainwhynot.Ifyes,showanorderofinsertingthekeysandtheresultingtree.Sol:(a)第2頁,共6頁第3頁,共6頁(b)輸入碼的次序(此中一種):10,30,50,60,40,20第4頁,共6頁第5頁,共6頁Question3.(25marks)ConsiderthefollowingtworelationsRandS.ThenumberofrecordsinRandSisalsogiven.R(A,B,C,D):20,000recordsS(A,E):36,000recor
8、dsAssumingthesizeofeachmemorypageis4Kbytesandthememorybufferhas30pages.Forsimplicity,wetake4Kas4000;weassumeallattributevaluesandpointers,ifneededtobeconsidered,are10bytes.ConsiderthefollowingSQLquery:Query:SELECTB,EFROMR,SWHERER.A=S.AGiveestimationofthefollowingquestions.Allthecomputationsstepsandt
9、heirreasoningshouldbeclearlyexplained.(a)(10marks)WhatisthesizeofRandSintermsofpages?EachRrecordis(10 x4)=40bytesandeachSrecordis(10 x2)=20bytes.Thereare4000/40=100Rrecordsperpageand4000/20=200Srecordsperpage.Therefore,Rcontains20000/100=200pagesandScontains36000/200=180pages.(b)(15marks)Assumeusing
10、sort-mergejointoprocessthequeryasfollows:Step1:SortRonR.Aandstorethesortedrelationindisk,assumingwediscardirrelevantattributesassoonaspossible.Step2:SortSonS.AbutcomparewithR(sortedalreadyinStep1)onceasortedpageofSisgeneratedinthefinalpass,assumingwediscardirrelevantattributesassoonaspossible.Sept3:
11、TransfersortedRpagebypagefromdisktomemorybuffertocomparethesortedpagesofSgeneratedinStep2.Estimatethecostofeachstepandthencomputethetotalcostofsort-mergejoin.Step1:Wehave200/30=7sortedruns.Ateachsortedrun30Rpagesarereadand15pagesarewrittenduetodiscardingattributeCandD.Onemorepasscanmergeall.Costofso
12、rtingR=200+100(firstpass)+100+100(finalpass)=500pages.Step2:Wehave180/30=6sortedruns.Ateachsortedrun30Spagesarereadand30pagesarewritten(noattributecanbediscarded).Onemorepasscanmergeallandthegeneratedpagesareusedfordirectcomparison.CostofsortingR=180+180(firstpass)+180(halfofthefinalpassduetoimmedia
13、temergingwithRpages)=540Step3:CostoftransfersortedR=100Totalcost=500+540+100=1140pagesQuestion4.(15marks)ConsiderthescheduleSthatconsistsoffourtransactionsasfollows:S=.Thenotationisself-explanatory.Forexample,T2_R(X)meansthattransactionT2readsitemX.第6頁,共6頁T1T2T3T4R(X)W(X)R(Z)R(Z)R(Y)W(Z)R(X)W(X)W(Y)
14、W(Z)R(Y)(9marks)ConstructtheprecedencegraphofS.Explainwhyorwhynotthescheduleisconflict-serializable.Itconflicts-serializable,nocircle.(6marks)IfyoufindthatSisserializablein(a),writedownallequivalentserialschedulesofS.T2,T3,T1,T4Question5(20marks)TherelationaldatabaseschemaforaCar-insurancecompanyisg
15、ivenbelow:person(driver-id,name,address)car(license,year,model)accident(report-number,location,date)owns(driver-id,license)participated(report-number,driver-id,license,damage-amount)employee(person-name,street,city)works(person-name,company-name,salary)company(company-name,city)manages(person-name,m
16、anager-name)(10marks)Giveanexpressionintherelationalalgebratoformulateeachofthefollowingqueries:a.FindthenamesofallemployeeswhoworkforthecompanyChina”“.Bankperson-name(company-name=BankChina(works)b.Findthenamesandcitiesofresidenceofallemployeeswhoworkfor“BankChina”.(employee(works)person-name,citycompany-name=BankChina第7頁,共6頁“WaiHuan
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026屆湖南省郴州市汝城縣中考聯(lián)考英語試題含答案
- 江蘇省無錫市濱湖中學(xué)2026屆中考考前最后一卷語文試卷含解析
- 2025年陜西省咸陽市禮泉縣小升初數(shù)學(xué)試卷
- 2025年河北省石家莊市精英小學(xué)小升初數(shù)學(xué)試卷
- 部編版語文七年級(jí)上學(xué)期《紀(jì)念白求恩》課件
- 江蘇省蘇州昆山市、太倉市市級(jí)名校2026屆中考三模英語試題含答案
- 江蘇省南京市溧水縣2026屆畢業(yè)升學(xué)考試模擬卷英語卷含答案
- 鉛鋅冶煉項(xiàng)目可行性研究報(bào)告
- 2025版電商公司股權(quán)置換與市場(chǎng)拓展及品牌推廣合作協(xié)議
- 二零二五年度瓷磚產(chǎn)品研發(fā)與技術(shù)創(chuàng)新合同
- 2025版幼兒園保育員職業(yè)技能考試試題(附答案)
- 電信維護(hù)協(xié)議書
- 登革熱與基孔肯雅熱防控指南
- 材料力學(xué)第4版單輝祖習(xí)題答案
- 《高效能人士的七個(gè)習(xí)慣》PPT演講模板
- 消力池深、長(zhǎng)計(jì)算
- 實(shí)驗(yàn)室病原微生物危害評(píng)估報(bào)告
- 診所依法執(zhí)業(yè)承諾書樣張
- 培智3年級(jí)《認(rèn)識(shí)人民幣》
- 小學(xué)數(shù)學(xué)三年級(jí)奧數(shù)舉一反三課件
- GB/T 7689.2-2013增強(qiáng)材料機(jī)織物試驗(yàn)方法第2部分:經(jīng)、緯密度的測(cè)定
評(píng)論
0/150
提交評(píng)論