Sie sind auf Seite 1von 2

DatabaseCourseExercises3 AMDay2:Datamodellingofdescribedscenarios Theseexercisesarebestdiscussedinsmallgroups.Foreachofthescenariosgiven: 1. 2. 3. 4. Decidewhatentitiesweneedtoconsiderinadatamodel CreateanERD Determinewhatvaluesneedtobestoredforeachentity,anddeterminesuitableprimarykeys. Whatassumptionsdoesyourmodelmake? Whatinformationinthetextwasirrelevanttoyourdesign? Whatfurtherrestrictionsmightyouwanttoapplytothedata?

Scenario1SitesandSwords: Anarchaeologistisworkingontheswordsfoundatvariousburialsites.Shewantstobeabletoanalysethe detailsoftheswordsandcomparethemtotheageofthesite,anditslocation.Locationsarespecifiedbygrid referencea3digiteastinganda3digitnorthing. Thearchaeologistwantstostorethefollowingdata: sitename,sitelocation,ageofsite,swordlength,bladematerial,handlematerial Scenario2Carpool: Acompanyoperatesacarpoolofvariousvehicles.Theydecidetokeeprecordsofallcarsreservedorcurrently bookedoutinarelationaldatabase. Eachcarhasamake,model,registrationnumber,andnumberofseats Eachemployeehasaname,employeeidandcontactnumber Companypolicysaysanemployeemayloanoutacarforupto7days.Ifacaristakenoutbyseveral employeeswhoallintendtodrivethevehicle,theymustallbeloggedinthedatabaseforinsurancepurposes. Atanygiventime,wewanttoknowwhichcarsareout,andwhatreservationshavebeenmade. Youmayassumethatwedon'tneedtotokeepalogofpastrentals. Scenario3Families (takenfromhttp://www.databasedesign.co.uk/bookdatabasesafirstcourse/chap3/chap3.htm) Drawanentityrelationshipdiagramandlistallattributesincludingtheprimarykeyforeachentitytype,fora databasesuitableforshowingfatherhood,motherhood,brotherhood,sisterhood,cousins,nephews,nieces andnephews,grandparents,inshortallfamilyrelationships.Rememberthatitispossibletoreproduce withoutmarriageandthatmarriagedoesnotimplyreproduction.Itispossibletomodelthiswithoneentity type. Showhowthemodelchangesifwewishtokeeparecordofmarriageandspouserelationships.Keepthe modelassimpleaspossible.Thereshouldbenoredundantdata.Itwouldberedundantforexample,tostate thatpersonsAandBwerebrothersandalsothattheysharedamother;sharingamotherandthefactthatthey arebothmaleimpliesthattheyarebrothers(orhalfbrothers). Thesecretinthisexampleistoisolatethemostfundamentalfactabouthumanreproduction,divorcedfrom artificialsocialconstructions. Scenario4Coachschedule Again,attemptthequestionsatthetopwiththisscenario.Disclaimerthisisratherinvolved.Youwillnotget adefinitiveanswer! BloodhoundCoachesrunsdailyscheduledservicesalloverthecountry.Customerswanttocheckthe

schedulesandpricesonline,soafirststepistoputthescheduleintoadatabase. Thecompanyrunsservicestomanytowns.Sometownshavedepots,andsomedonot. Foreachdepotwewanttorecordacontacttelephonenumberandstreetname. Allservicesrunbetweentwodepots,stoppingatanumberofstopsinbetween.Eachroutehasanumber,and buseswilldrivethatrouteseveraltimesaday. Ticketcostsarecalculatedasasimplesumofpricesbetweeneachpairofstopsvisited. However,theremaybespecialpricesfromtimetotime,betweentwospecifictowns. Childrengoforhalfprice. Customerswanttobeabletocheckthepriceofanydirectjourney,andtofindoutalltheroutenumbersthat visitagivenstop. Thetimetakentodriveadirectroutebetweenanytwostopsisalsoknown. Thisisassumedtobeconstantthroughouttheday. Currentlyasampleprintedtimetablelookslikethis: Route Oxford GreaterTew WestwardHo! Peebles MarshGibbon Dunkirk Edinburgh Edinburgh Dunkirk MarshGibbon Peebles WestwardHo! GreaterTew Oxford 101 09:00:00 09:15:00 10:30:00 11:20:00 11:45:00 13:00:00 14:00:00 11:00:00 12:00:00 13:15:00 13:40:00 14:30:00 15:45:00 16:00:00 11:00:00 11:15:00 12:30:00 13:20:00 13:45:00 15:00:00 16:00:00 13:00:00 14:00:00 15:15:00 15:40:00 16:30:00 17:45:00 18:00:00 13:15:00 14:30:00 15:20:00 15:45:00 17:00:00 18:00:00 Price 13:00:00 FromOxford: 5 12 17 20 25 35

17:00:00 FromEdinburgh: 18:00:00 19:15:00 19:40:00 20:30:00 21:45:00 22:00:00 10 15 18 23 30 35

Das könnte Ihnen auch gefallen