数据的库系统基础的教程第四章答案.pdf
《数据的库系统基础的教程第四章答案.pdf》由会员分享,可在线阅读,更多相关《数据的库系统基础的教程第四章答案.pdf(10页珍藏版)》请在淘文阁 - 分享文档赚钱的网站上搜索。
1、.Solutions Chapter 4 a b c In c we assume that a phone and address can only belong to a single customer.d In d we assume that an address can only belong to one customer and a phone can exist at only one address.If the multiplicity of above relationships were m-to-n,the entity set bees weak and the k
2、ey ssNo of customers will be needed as partof the posite key of the entity set.In c&d,we convert attributes phones and addresses to entity sets.Since entity sets often bee relations in relational design,we must consider more efficient alternatives.Instead of querying multiple tables where key values
3、 are duplicated,we can also modify attributes:Phones attribute can be converted into HomePhone,OfficePhone and CellPhone.a b c The relationship played between Teams and Players is similar to relationship plays between Teams and Players.a Assumptions A Professor only works in at most one department.A
4、 course has at most one TA.A course is only taught by one professor and offered by one department.Students and professors have been assigned unique email ids.A course is uniquely identified by the course no,section no,and semester.Given that for each movie,a unique studio exists that produces the mo
5、vie.Each star is contracted to at most one studio.But stars could be unemployed at a given time.Thus the four-way relationship in fig 4.6 can be easily into converted equivalent relationships.Redundancy:The owner address is repeated in AccSets and Addresses entity sets.Simplicity:AccSets does not se
6、rve any useful purpose and the design can be more simply represented by creating many-to-many relationship between Customers and Accounts.Right kind of element:The entity set Addresses has a single attribute address.A customer cannot have more than one address.Hence address should be an attribute of
7、 entity set Customers.Faithfulness:Customers cannot be uniquely identified by their names.In real world Customers would have a unique attribute such asssNo or customerNo Studios and Presidents can be bined into one entity set Studios with Presidents being an attribute of Studios under followingcircu
8、mstances:1.The Presidents entity set only contains a simple attribute viz.presidentName.Additional attributes specific to Presidents might justify making Presidents into an entity set.aStars:starName bMovies:movieName cStudios:studioName.However there exists a many-to-many relationship between Studi
9、os and Contracts.Hence,in addition,we need more informationabout studios involved.If a contract always involves two studios,two attributes such as producingStudio and starStudio can replace the Studios entity set.If a contact can be associated with at most five studios,it may be possible to replace
10、the Studios entityset by five attributes viz.studio1,.studio2,studio3,studio4,and studio5.Alternately,a posite attribute containing concatenation ofall studio names in a contact can be considered.A separator character such as$can be used.SQL allows searching of such an attribute using query like%key
11、word%From Augmentation rule of Functional Dependency,given B-M then BND-M Hence we can just put an arrow entering mother.a Put an arrow entering entity set Mothers for the simplest solution.However,we can display more accurate information with below figure.b c Again from Augmentation rule of Functio
12、nal Dependency,given BM-D then BMN-D Thus we can just add an arrow entering Doctors to fig 4.15.Below figure represents more accurate information however.a b Transitivity and Augmentation rules of Functional Dependency allow arrow entering Mothers from Births.However,a new relationship in below figu
13、re represents more accurate information.c Design flaws in abc above 1.As suggested above,using Transitivity and Augmentation rules of Functional Dependency,much simpler design is possible.In below figure there exists a many-to-one relationship between Babies and Births and another many-to-one relati
14、onship between Births andMothers.From transitivity of relationships,there is a many-to-one relationship between Babies and Mothers.Hence a baby has a uniquemother while a birth can allow more than one baby.a b A captain cannot exist without a team.However a player can.A recently formed team can exis
15、t without players or colors.c Children can exist without mother and father.a The keys of both E1 and E2 are required for uniquely identifying tuples in R b The key of E1 c The key of E2 d The key of either E1 or E2 Special Case:All entity sets have arrows going into them i.e.all relationships are 1-
16、to-1 Any Ki Otherwise:bination of all Kis where there does not exist an arrow going from R to Ei.No,grade is not part of the key for enrollments.The keys of Students and Courses bee keys of the weak entity set Enrollments.It is possible to make assignment number a weak key of Enrollments but this is
17、 not good design.A new entity set Assignment is created and it is also a weak entity set.Hence the key attributes of Assignment will e from thestrong entity sets to which Enrollments is connected i.e.studentID,dept,and CourseNo.a b c a b Customers Flights Bookings Relations for toCust and toFlt rela
18、tionships are not required since the weak entity set Bookings already contains the keys of Customers and Flights.Schema is changed.Since toCust is no longer an identifying relationship,SSNo is no longer a part of Bookings relation.Bookings ToCust The above relations are merged into Bookings However
19、custSSNo is no longer a key of Bookings relation.It bees a foreign key instead.Ships SisterOf Stars Studios Movies Contracts Depending on other relationships not shown in ER diagram,studioName may not be required as a key of Contracts.Students Courses Enrollments Departments Courses Leagues Teams Pl
20、ayers The weak relation Courses has the key from Depts along with number.Hence there is no relation for GivenBy relationship.Depts Courses LabCourses LabCourses has all the attributes of Courses.Depts Courses LabCourses Courses and LabCourses are bined into one relation.Depts Courses Person ChildOf
21、Child Father Mother.Since FatherOf and MotherOf are many-one relationships from Child,there is no need for a separate relation for them.Similarly the one-one relationship Married can be included in Father.ChildOf is a many-many relationship and needs a separate relation.However the ChildOf relation
22、is not required since the relationship can be deduced from FatherOf and MotherOf relationships contained in Child relation.A person cannot be both Mother and Father.Person PersonChild PersonChildFather PersonChildMother PersonFather PersonMother ChildOf FatherOf MotherOf Married The many-many ChildO
23、f relationship again requires a relation.An entity belongs to one and only one class when using object-oriented approach.Hence,the many-one relations MotherOf and FatherOf could be added as attributes to PersonChild,PersonChildFather,and PersonChildMother relations.Similarly the Married relation can
24、 be added as attributes to PersonChildMother and PersonMother.For the Person relation at least one of husband and wife attributes will be null.Person ChildOf People Males Females Fathers Mothers ChildOf People PeopleMale PeopleMaleFathers PeopleFemale PeopleFemaleMothers ChildOf FatherOf MotherOf Pe
25、ople cannot belong to both male and female branch of the ER diagram.Moreover since an entity belongs to one and only one class when using object-oriented approach,no entity belongs to People relation.Again we could replace MotherOf and FatherOf relations by adding as attributes to PeopleMale,PeopleM
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 数据 系统 基础 教程 第四 答案
限制150内