下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
中山大学软件学院2009级软件工程专业(2010学年春天学期)《SE-304数据库系统原理》期末考试一试卷(B)(考试形式:开卷考试时间:2小时)《中山大学授与学士学位工作细则》第六条警示考试舞弊不授与学士学位方向:姓名:学号:Question1LogicalDatabases(20marks)YouarerequiredtoconstructanERDiagramforarestaurantwhichmaintainsdataaboutthefollowingthreeentities:dish,staffandtransaction.Thethreerelationshipsarebill,cookandprocessed-byandthedetailsoftherelationshipsaredescribedasfollows:?Arecordindishisuniquelyidentifiedbyafive-digitdish-code,andcontainstheinformationforthenameofthedish,thepriceofthedish;Astaffmemberhasstaff-id,name,andworking-time-info;Eachdishiscookedbyexactlyonestaffmember,butastaffmembercancookmorethanonedishes,assumethatallthestaffmemberscancookforsimplicity;Atransactioncanbeuniquelyidentifiedbythefollowinginformation:date,time,andtheresponsiblestaffwhohasprocessedthetransaction.Morethanoneunitsofthesamedishcouldbesoldandshouldberecordedbyadistincttransaction,thisrelationshipiscalledbill.(15marks)DrawtheERdiagramthatconsistsofthethreeentitiesandthethreerelationships.YoushouldwritedowntheassumptionsclearlyifyouthinkthattheabovedescriptionofthethreeentitiesandthreerelationshipsisnotadequatefordrawingtheERDiagram.YoushouldalsoindicateallimportantinformationoftheERDiagramsuchaskeys,weakentitiesandcardinalities.(5marks)ConverttheaboveERDiagramintothecorrespondingrelationalschemas.Underlinealltheattribute(s)oftheprimarykey.Specifyclearlywhetheraschemaisobtainedfromanentity,aweakentityorarelationship.第1页,共5页Question2IndexingStructure(18marks)Supposethatweareusingextendablehashingindexthatcontainsthefollowingsearch-keyvaluesK:2,10,10,12,15,15,3,13.Assumingthesearch-keyvaluesarriveinthegivenorder(i.e.2beingthefirstcomingkeyand13beingthelastone).Showtheextendablehashstructureforeachcaseofinsertingagroupoftheabovekeyvaluesifthehashfunctionish(x)=xmod16andbucketscanholdtwokeys.Theinitialconfigurationofthestructureandthebinaryformofallkeysaregiveninthediagrambelow.Conventionrequirement:Youshouldusethebitsstartingfromthemost-significantoneorMSB(theleft-handside)asthehashingindex.InitialhashtableEmptybucketBinaryvaluesofallkeysKAfterinserting2,10,10;Afterinserting12;Afterinserting15,15,3,13.第2页,共5页Question3(22marks)JoinAlgorithmsConsiderthefollowingtworelationsRandS.ThenumberofrecordsinRandSisalsogiven.R(A,B,C,D):5,000recordsS(A,E,F,G):18,000recordsThesizesofallattributevaluesaregiveninthetable.ABCDEFG10bytes20bytes30bytes20bytes50bytes20bytes20bytesAssumethesizeofeachmemorypageis4Kbytesandthememorybufferhas25pages.Allthecomputationsshouldshowthesteps.ConsiderthefollowingSQLquery:Query:SELECTC,EFROMR,SWHERER.A=S.A(4marks)WhatisthesizeofRandSintermsofpages?(18marks)Assumeusingsort-mergejointoprocessthequeryasfollows:Step1:SortRonR.Aandstorethesortedrelationindisk,assumingwediscardirrelevantattributesassoonaspossible.(Note:Youmayneedtorounduptowholepageafterremovingtheirrelevantattributesinthefirstpass.)Step2:SortSonS.AbutcomparewithR(sortedalreadyinStep1)onceasortedpageofSisgeneratedinthefinalpass,assumingagainwediscardirrelevantattributesassoonaspossible.(Note:Spagesgeneratedinthefinalpassdonotneedtowritebacktodisk.)Sept3:TransfersortedRpagebypagefromdisktomemorybuffertocomparethesortedpagesofSonceasortedpageisgeneratedinStep.2Estimatethecostofeachstepandthencomputethetotalcostofsort-mergejoin.第3页,共5页Question4(20marks)PhysicalDatabaseDesignConsiderthefollowingschemaswithusualmeaning:Studentsandprofessorsbelongtosomedepartments.Studentsareenrolledinthecoursesofferedbysomeprofessors.Thesizeofalltheattributevaluesisassumedtobethesameineachschema.TABLES:NoofrecordsNoofpagesDEPARTMENT(D_ID,D_NAME,HEAD_ID)10020PROFESSOR(P_ID,P_NAME,SALARY,D_ID)1,000100STUDENT(S_ID,S_NAME,D_ID)10,0001,000COURSE(C_ID,C_NAME,D_ID)1,000100OFFERING(O_ID,C_ID,YEAR,SEMESTER,P_ID)10,0001,000ENROLL(S_ID,O_ID,GRADE)100,00010,000Generalinformation:Thereare500differentprofessornames,1,000differentstudentnames,and100differentdepartmentnames.Ontheaverage,eachstudentisenrolledin10offeringsandeachofferinghas10students.Eachdepartmentoffers10courses.Assumethatprofessorsalariesareuniformlydistributedintherangefrom10,000to110,000.Indexinformation:Allindexpagesarestoredindisk.WeassumeB-treeswithheight3forclusteredindexstoredandtherearenooverflowbucketsforhashindex.Forindexesonanon-candidatekey,youmayhavemultipleentrieswiththesamesearchkeyentry.Wealsoignorethecrossfactorformultiplerecordswithsamesearchkeyinafileifthenumberofrecordsiswithinthepagelimit.Weoptimizethequeriesin(a)and(b)asfollows.Query1:Displaythenamesofallprofessorswhosesalaryisintherangefrom30,000to35,000.Approach1:Buildaclusteredindexonprofessor.salary.Approach2:Buildamulti-attributeindexon<salary,p_name>anddoindex-onlyscan.Whichapproachisbetter?Youranswershouldbebasedonthecostestimationwithclearexplanations.(b)Query2:Givenaprofessor’name,sfindthenameofthedepartmentthattheprofessorbelongsto.Approach1:Buildonehashindexonprofessor.p_nameandanotherhashindexondepartment.d_id.Approach2:Buildonehashindexonprofessor.p_nameandahashfileorganizationondepartment.d_idwherethedepartmentrecordsarepartitionedin5buckets.Whichapproachisbetter?Youranswershouldbebasedonthecostestimationwithclearexplanations.第4页,共5页Question5TransactionManagement(20marks)(2marks)GivetworeasonswhyaserialschedulefordatabasetransactionsisnotpracticalforcommercialDBMSs.Inthefollowingquestions,thenotationisself-explanatory.Forexample,R1(X)meanstransactionT1readsitemX.Similarly,“W”meansWRITEand“C”means“Commit”.(18marks)Foreachofthefollowingschedules,indicatewhetheritisconflictserializableandrecoverable.Ifitisconflictserializable,thenwriteoutoneequivalentserialschedule.Thefollowingisanexampleo
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 化工厂充装人员课件培训
- 《汽车文化》课件 第二章 汽车基本结构 第一节 汽车的分类
- 福建省泉州市第五中学2025-2026学年上学期期末七年级数学试卷(无答案)
- 2026年陕西省西安市碑林区西北工大附中中考数学第一次适应性试卷(含简略答案)
- 2026年度牛市下半场实物再通胀
- 钢结构焊接材料选用技术要点
- 2026年上半年黑龙江事业单位联考省人民政府黑瞎子岛建设和管理委员会招聘4人备考考试题库及答案解析
- 2026内蒙古鄂尔多斯市城投商业运营管理有限公司招聘46人参考考试题库及答案解析
- 市场调研公司数据管理制度
- 2026湖南株洲市天元中学招聘编外合同制教师考试备考试题及答案解析
- 电站火灾事故应急预案
- GJB827B--2020军事设施建设费用定额
- 娃娃菜栽培技术
- 工业锅炉司炉课件
- 数字营销专业人才培养方案
- 新疆概算管理办法
- 女性中医健康养生讲座
- 《养老服务政策法规与标准》智慧健康养老服务专业全套教学课件
- 知识付费商业模式设计
- 无锡车联天下信息技术有限公司智能网联汽车车载显示模组研发及智能化生产项目环评资料环境影响
- 抹灰层阴阳角方正度控制技术
评论
0/150
提交评论