e-r建模及关系表转换-例题习题_第1页
e-r建模及关系表转换-例题习题_第2页
e-r建模及关系表转换-例题习题_第3页
e-r建模及关系表转换-例题习题_第4页
e-r建模及关系表转换-例题习题_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、ConsiderthefollowinginformationinanairportdatabaseAnairportisdescribedbyitsnameandthecitythattheairportIocatesatEachairpIanehasanuniqueregistrationnumberandaIsothedateofproductionasitsdescriptiveattributesEachairplanemodeIisidentifiedbyamodeInumberandhasacapacityandaweightAtechnicianischaracterizedb

2、yanuniquetechnician_id,hisnameandhisphonenumberEachairportaccommodatesanumberofairpIanemodeIs,andanairpIanemodeImayappearsinseveraIairports;butsomeairportsarenotsuitabIeforaccommodaingseveraIspecialpIanemodeIs.EachairpIaneisofaspecificmodeI,e.g.Boeing737;andforeachmodeI,therearemorethanoneairplanebe

3、ingofit.foreachairport,therearesometechniciansworkingthere,andeachtechnicianmustworksatonlyoneairport.EachtechnicianisresporisibleforoneormorepIanemodeIs,andeachplanemodelhasatleastonetechnicianresponsibleforitEachairpIaneisperiodicallytestedbyanumberoftechnicianstoensurethattheairplaneisstillairwor

4、thy.AtechnicianmaytestseveraIairplaneseachyear,andsometimesatechnicianhasnotaskfortestingtheairplanes?ItisrequiredthatwhenatechniciantestsanairpIane,theairplanemodeIthatheisresponsibleforisjustthemodeIthattheairpIanetestedisof.Theinformation,suchasthetestnumber,thetestingdate,thetestingresultandthet

5、imespentonthetest,isneededtodescribeatestingoftheairplane(1) DesigntheE/RdiagramfortheairportdatabaseonthebasisoftheinformationmentionedaboveNote:theprimarykeyoftheentities,mappingcardinalityofeachrelationshipandparticipationofeachentitytotherelationshipshouldbedescribedinthediagram.(10points)(2) Co

6、nverttheE-Rdiagramtotheproperrelationalschema,andgivetheprimarykeyofeachrelationschemabyunderlines.(10points)Answers:ui-namey(weight):*<TQcapacily)< m-num J)airport<5acc o m inodatemodelwork<ponsib>be-of J> technician(t-nuin)JZ;、一testaiiplane(bnamc)CresulDCtimejdate)X (re-nun】)(pho

7、nejiuni)-dale)(10points)实体airport归结为:airport(a-name,city);实体model归结为:model(m-num,weight,capacity);联系accommodate归结为:accominodate(a-name,nvnum);实体airplane和联系be?of归结为:airplane(re-num,date,m-num);实体technician>联系work归结为:technician(上t-name,phone-num,a-name)联系test归结为:test(t-id,re-num,t-num,t-date,time,r

8、esult)联系responsible归结为:responsible(Md,nvnum)二、Auniversitystudentdatabaseneedstostoreinformationaboutstudents八professors八projects八anddepartments.Considerthefollowinginformation:?EachstudenthasaSNo,aname,anage,andadegreeprogram(e.g.M.S.orPh.D.).?EachprofessorhasaPNo,aname,anage,andaresearchspecialty.?

9、Eachprojecthasaprojectnumber,astartingdate,anendingdate,andabudget.?Eachdepartmenthasadepartmentnumber,adepartmentname,andamainoffice.?integrityconstraints:a. Astudentstudiesinone(andonlyone)departmentb. AProfessorworksinone(andonlyone)departmentc?Eachprojectmustbemanagedbyoneandonlyoneprofessor,and

10、eachprofessormustmanageatleastoneproject.d. Eachprojectisworkedonbysomestudents,morethanonestudentcanparticipate(orworkon)thesameproject,andsomestudentsmayworkonnoprojects.e. Whenastudentworkonaproject,theprofessormanagingthisprojectmustsupervisethestudentswork.Onestudentmayworkonseveralprojects,soh

11、emayhaveseveralsupervisors?(1) DesignanddrawanE/Rdiagramforthisdatabasethatcapturestheinformationabove?Note:mappingcardinalityofeachrelationshipandparticipationofeachentitytotherelationshipshouldbedescribedinthediagram.(2) ConverttheE-Rdiagramtotheproperrelationalschema,andgivetheprimarykeyofeachrel

12、ationschemabyunderlines?Answers:E-RdiagramisasfollowsUKiinej/degree,、Vperanz"departtnehrx<-numberJ(SNo/studentsludy>idepartinent/main、V_-office_x<garticipat><&jpcrvisoj>><Lworks(budget)projectsjnanaee7/project-number/'、fndin宜、X.J-dtUc)AtarimgV-dateJ:professor<

13、name><rescarch;><areasJ(2) thereducedtablesareasfollows:department-number)(a) student(SNo,name,age,degree-program,Note:relationshipstudyisreducedtothistable(b) professor(PNo,name,age,research-area,department-number)Note:relationshipworksisreducedtothistable(c)department(departdepart-name

14、,main-officer)(d) project(project?number,starting-date,ending-date,budget,PNo)Note:relationshipmanageisreducedtothistable(e) participate(SNo,project-number)supervisor(SNo,PNo)solution2:(1) E-RdiagramisasfollowsstudentparticipatedJbudset;epartmen?name1studyupervisoi/departments<-numberJtdepartment

15、sX*13O-tmain-officeworks、PMprojectCBS)I k J-vendingJ-datU_一一_一hstartinej,-cate"dprofessoriresearc;1areas(2) thereducedtablesareasfollows:(a) student(SNo,name,age,degree-program,department-niunber)Note:relationshipstudyisreducedtothistable(b) professor(PNo,name,age,research-area,department-numbe

16、rNote:relationshipworksisreducedtothistable(c)department(department-number,depart-name,main-officer)(d) project(project-number,starting-date,ending-date,budget,PNo)Note:relationshipmanageisreducedtothistable(e) participate(SNo,project-number)(f) supervisor(SNo,PioiecJnumber,PNo)三.NotovvnRecordscompa

17、nyneedstostoreinformationaboutsongs,albums(专辑)andmusicianswhoperformonitsalbumsinadatabase.Considerthefollowinginformation:?EachmusiciansthatrecordsatcompanyhasanId(whichisunique),aname,anaddress,andaphonenumber.?EachinstrumentusedincompanyhasanameandanuniqueID.?EachalbumrecordedontheNotownlabelhasa

18、title,acopyrightdate,aformat,andanalbumidentifier.?EachsongrecordedatNotownhasatitleandanauthor,andeachsongcanbeidentifiedbyitstitle.?Anmusicianmayplayseveralinstruments,andaninstrumentsmaybeplayedbyseveralmusicians?Eachalbumhasanumberofsongsonit,andeachsongbelongstoonlyonealbum.?Eachsongisperformed

19、byoneormoremusicians,andamusicianmayperformanumberofsongs?Eachalbumhasexactlyonemusicianwhoactsasitsproducer.Amusicianmayproduceseveralalbums,butsomemusiciansmayhavenoalbums.(1) DesigntheE/Rdiagramforhospitaldatabaseonbasisoftheinformationmentionedabove.(10points)Note:mappingcardinalityofeachrelatio

20、nshipandparticipationofeachentitytotherelationshipshouldbedescribedinthediagram.(2) ConverttheE-Rdiagramtotheproperrelationalschemas,andgivetheprimarykeysofeachrelationschemasbyunderlines.(10points)四、Ahospitaldatabaseneedstostoreinformationaboutdoctors,patients,sickroom(病房),anddepartments(科室).Consid

21、erthefollowinginformation?Eachdoctorhasdescriptiveattributesofidentifiernumber,name,age,andtechnicaltitle).?Eachpatienthasdescriptiveattributesofthenumberofmedicalrecords(病历),name,age,andsex?Eachsickroomhasdescriptiveattributesofthenumberofsickroom,theaddress?Eachdepartmenthasdescriptiveattributesof

22、name,address,telephone-number?Integrityconstraints:a. Eachdoctormustbelongtoone(andonlyone)department;andforeachdepartment,therearemorethanonedoctorsbelongingtoit.b. Eachpatientistakencareofbyoneandonlyoneresponsibledoctor;adoctormayberesponsiblefornopatients,oronlyonepatients,ormorethanonepatientsc

23、. Eachpatientlivesinoneandonlyonesickroom;asickroommaycontainmorethanonepatientsd?Eachsickroomcanbemanagedbymorethanonedepartment;butforsomedepartments,therearenosickroomsmanagedbythem,whileforotherdepartments,therearemorethanonemanagedsickroom?(1) DesigntheE/Rdiagramforhospitaldatabaseonbasisofthei

24、nformationmentionedabove?(10points)Note:mappingcardinalityofeachrelationshipandparticipationofeachentitytotherelationshipshouldbedescribedinthediagram?(2) ConverttheE-Rdiagramtotheproperrelationalschema,andgivetheprimarykeyofeachrelationschemabyunderlines.(10points)五.(20points)Apharmaciesdatabasenee

25、dstostoretheinformationaboutthepharmaceuticalcompanies(帝l药公司)andothers.Therelevantinformationisasfollows:?Eachpharmaceuticalcompanyisidentifiedbyitsnameandhasaphonenumber.?Eachpharmacy(药房)isidentifiedbyitsnameandhasanaddress,andseveralphonenumbers?Foreachdrug?thetradenameandformulamustberecorded,and

26、thetradenameidentifiesadruguniquely.?Eachdrugisdevelopedbyonlyonegivenpharmaceuticalcompany,andonepharmaceuticalcompanycandevelopseveraldrugsandperhapsdevelopsnodugnow.?Eachpharmacysellsseveraldnjgsandhasapriceforeach?Adrugcouldbesoldbyseveralpharmacies,andthepricemayvaryfromonepharmacytoanother.?Ph

27、armaceuticalcompaniesmakecontractswithpharmacies,butsomepharmaceuticalcompaniesmayhavenocontract.Apharmaceuticalcompanycansigncontractswithseveralpharmacies,andapharmacycanalsoenterintocontractswithseveralpharmaceuticalcompanies.Eachcontractisdescribedbyastartdate,anenddateandthecontentofthecontract

28、?(1) DesigntheE/Rdiagramforhospitaldatabaseonbasisoftheinformationmentionedabove?(10points)Note:themappingcardinalityofeachrelationshipandparticipationofeachentitytotherelationshipshouldbedescribedinthediagram.(2) ConverttheE-Rdiagramtotheproperrelationalschemas,andgivetheprimarykeyofeachrelationschemabyunderlines?(10points)六、(8Points)Aschoolisgoingtoarrangeasportsdayforthestudents.Adatabasetokeeptrackofparticipantsandactivitiesduringthesportsdayistobecreated.

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论