資源描述:
《Solutions to Exercises》由會(huì)員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在教育資源-天天文庫(kù)。
1、《IntroductiontoDatabaseSystem》SolutionstoExercisesLiPing28Chapter2TheEntity-RelationshipDataModelExercise2.1.1:Letusdesignadatabaseforabank,includinginformationaboutcustomersandtheiraccounts.Informationaboutacustomerincludestheirname,address,phone,andSocialSecuritynumber.Accountshavenumbers,types(e.
2、g.,savings,checking)andbalances.Wealsoneedtorecordthecustomer(s)whoownanaccount.DrawtheE/Rdiagramforthisdatabase.Besuretoincludearrowswhereappropriate,toindicatethemultiplicityofarelationship.P.36Solution:Exercise2.1.6:Supposewewishtokeepagenealogy.Weshallhaveoneentityset,People.Theinformationwewish
3、torecordaboutpersonsincludestheirname(anattribute)andthefollowingrelationships:mother,father,andchildren.GivenanE/RdiagraminvolvingthePeopleentitysetandalltherelationshipsinwhichitisinvolved.Includerelationshipsformother,father,andchildren.Donotforgettoindicateroleswhenanentitysetisusedmorethanoncei
4、narelationship.Solution:PeoplechildrenOfFemalechildrenOfMalechildrenOfchildrenmotherfatherchildrenchildrenparentsExercise2.2.1:InFig.2.14isanE/Rdiagramforabankdatabaseinvolvingcustomersandaccounts.Sincecustomersmayhaveseveralaccounts,andaccountsmaybeheldjointbyseveralcustomers,weassociatewitheachcus
5、tomeran“accountset”,andaccountsaremembersofoneormoreaccountsets.Assumingthemeaningofthevariousrelationshipsandattributesareasexpectedgiventheirnames,criticizethedesign.Whatdesignrulesareviolated?Why?Whatmodificationswouldyousuggest?P.4428Solution:1.TheAddressesentitysetisnothingbutasingleaddress,sow
6、ewouldprefertomakeaddressanattributeofCustomers.Werethebanktorecordseveraladdressesforacustomer,thenitmightmakesensetohaveanAddressesentitysetandmakeLives-atamany-manyrelationship.2.TheAcct-Setsentitysetisuseless.Eachcustomerhasauniqueaccountsetcontaininghisorheraccounts.However,relatingcustomersdir
7、ectlytotheiraccountsinamany-manyrelationshipconveysthesameinformationandeliminatestheaccount-setconceptaltogether.Exercise2.2.2:Underwhatcircumstances(regardingtheunseenattributesofStudiosandPresident