欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    数据的库系统基础的教程第四章答案.pdf

    • 资源ID:80021164       资源大小:267.45KB        全文页数:10页
    • 资源格式: PDF        下载积分:19.9金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要19.9金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    数据的库系统基础的教程第四章答案.pdf

    .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 key 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 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 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 movie.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 serve 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 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 followingcircumstances: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 Studios 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 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%keyword%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 Functional 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 figure 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 relationship 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 exist 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-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 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 relationships 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 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 Players 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 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 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 ChildOf 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 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 People 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,PeopleMaleFathers,PeopleFemale,and PeopleFemaleMothers relations.People ChildOf Each entity set results in one relation.Thus both the minimum and maximum number of relations is e.The root relation has a attributes including k keys.Thus the minimum number of attributes is a.All other relations include the k keys from root along with their a attributes.Thus the maximum number of attributes is a+k.The relation for root will have a attributes.The relation representing the whole tree will have e*a attributes.The number of relations will depend on the shape of the tree.A tree of e entities where only one child exists would have the minimum number of relations.Thus below figure will only contain 4 subtrees that contain root E1,E1E2,E1E2E3,and E1E2E3E4.With e entity sets,minimum e relations are possible.The maximum number of subtrees result when all the entities are at depth 1.Thus below figure will contain 8 subtrees that contain root E1,E1E2,E1E3,E1E4,E1E2E3,E1E3E4,E1E2E4,and E1E2E3E4.With e entity sets,maximum 2 relations are possible.The nulls method always results in one relation and contains attributes from all e entities i.e.e*a attributes.Summarizing for a,b,and c above;#ponents#Relations Min Max Min Max Method straight-E/R a a e e object-oriented a e*a e 2 nulls e*a e*a 1 1 a b c d Males and Females subclasses are plete.Mothers and Fathers are partial.All subclasses are disjoint.We convert the ternary relationship Contracts into three binary relationships between a new entity set Contracts and existing entity sets.a b c A self-association ParentOf for entity set people has multiplicity 0.2 at parent role end.In a Library database,if a patron can loan at most 12 books,them multiplicity is 0.12.For a FullTimeStudents entity set,a relationship of multiplicity 5.*must exist with Courses A student must take at least 5 courses to be classified FullTime.Customers Flights Bookings Customers Flights Bookings a Movies Studios Presidents Owns Runs Movies Studios Presidents Owns Runs b Since the subclasses are disjoint,Object Oriented Approach is used.The hierarchy is not plete.Hence four relations are required Movies MurderMysteries.Cartoons Cartoon-MurderMysteries Movies MurderMysteries Cartoons Cartoon-MurderMysteries c Customers Accounts Owns Customers Accounts Owns d Teams Players Fans Colors For Displays association,TeamColors RootsFor Admires Teams Players Fans Colors For Displays association,TeamColors RootsFor Admires e People People f Students Courses Departments Professors Takes Students Courses Departments Professors Takes a Each and every object is a member of exactly one subclass at leaf level.We have nine classes at the leaf of hierarchy.Hence we need nine relations.b All objects only belong to one subclass and its ancestors.Hence,we need not consider every possible subtree but rather the total number of nodes in tree.Hence we need thirteen relations.c We need all possible subtrees.Hence 218 relations are required.class Customer key attribute integer ssNo;attribute string name;attribute string addr;attribute string phone;relationship Set ownsAccts inverse Account:ownedBy;.class Account key attribute integer number;attribute string type;attribute real balance;relationship Set ownedBy inverse Customer:ownsAccts;a Modify class Account to contain relationship Customer ownedBy b Also remove set in relationship ownsAccts of class Customer.c ODL allows a collection of primitive types as well as structures.To class Customer add following attributes in place of simple attributes addr and phone:Set Set d ODL allows structures and collections recursively.SetStruct addrstring street,string city,string state,Set Collections are allowed in ODL.Hence,Colors Set can bee an attribute of Teams.class Colorskey attribute string colorname;relationship Set FavoredBy inverse Fans:Favors;relationship set DisplayedBy inverse Teams:Displays;class Teamskey attribute string name;relationship set Displays inverse Colors:DisplayedBy;relationship set PlayedBy inverse Players:Plays;relationship PLayers CaptainedBy inverse Platyers:Captains;relationship set RootedBy inverse Fans:Roots;class Playerskey attribute string name;relationship Set Plays inverse Teams:PlayedBy;relationship Teams Captains inverse Teams:CaptainedBy;relationship Set AdmiredBy inverse Fans:Admires;class Fanskey attribute string name;relationship Colors Favors inverse Colors:FavoredBy;relationship Set RootedBy inverse Teams:Roots;relationship Set Admires inverse Players:AdmiredBy;class Person .attribute string name;relationship Person motherOf inverse Person:childrenOfFemale;relationship Person fatherOf inverse Person:childrenOfMale;relationship Set children inverse Person:parentsOf;relationship Set childrenOfFemale inverse Person:motherOf;relationship Set childrenOfMale inverse Person:fatherOf;relationship Set parentsOf inverse Person:children;The struct educationstring degree,string school,string date cannot have duplication.Hence use of Sets does not make any different as pared to bags,lists,or arrays.Lists will allow faster access/queries due to the already sorted nature.a class Departmentskey attribute string name;relationship Courses offers inverse Courses:offeredBy;class Courseskey attribute string number;relationship Departments offeredBy inverse Departments:offers;b class Leagues key attribute name;relationship Teams contains inverse Teams:belongs;class Teamskey attribute name,relationship Leagues belongs inverse Leagues:contains;relationship Players play inverse Players:plays;class Players key attribute number,relationship Teams plays inverse Teams:play;class Students attribute string email;attribute string name;relationship Courses isTA inverse Courses:TA;relationship Courses Takes inverse Courses:TakenBy;class Professors attribute string email;attribute string name;relationship Departments WorksFor inverse Department:Works;relationship Courses Teaches.inverse Courses:TaughtBy;class Courses key attribute string no;attribute string semester;attribute string section;relationship Students TA inverse Students:isTA;relationship Students TakenBy inverse Students:Takes;relationship Professors TaughtBy inverse Professors:Teaches;relationship Departments OfferedBy inverse Departments:Offer;class Departments attribute name;relationship Courses Offer inverse Courses:OfferedBy;relationship Professors Works inverse Professors:WorksFor;A relationship is its own inverse when for every attribute pair in the relationship,the inverse pair also exists.A relation with such a relationship is called symmetric in set theory.e.g.A relationship called SiblingOf in Person relation is its own inverse.a Customers Account Owns b Accounts Customers Addresses Phones We can remove Addresses relation since its attributes are a subset of relation Phones.c Fans RootedBy Admires Players Teams-remove subset of teamcolor Teamcolors Colors d class Person attribute string name;relationship Person motherOf inverse Person:childrenOfFemale;relationship Person fatherOf inverse Person:childrenOfMale;relationship Set children inverse Person:parentsOf;relationship Set childrenOfFemale inverse Person:motherOf;relationship Set childrenOfMale inverse Person:fatherOf;relationship Set parentsOf inverse Person:children;.Person The children relationship is many-many but the information can be deduced from Person relation.Hence below relation is redundant.Parent-Child First consider each struct as if it were an atomic value i.e.key and value association pairs can be

    注意事项

    本文(数据的库系统基础的教程第四章答案.pdf)为本站会员(1398****507)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开