数据库系统基础教程课后答案第四章资料

上传人:w****i 文档编号:107634442 上传时间:2019-10-20 格式:PDF 页数:45 大小:626.25KB
返回 下载 相关 举报
数据库系统基础教程课后答案第四章资料_第1页
第1页 / 共45页
数据库系统基础教程课后答案第四章资料_第2页
第2页 / 共45页
数据库系统基础教程课后答案第四章资料_第3页
第3页 / 共45页
数据库系统基础教程课后答案第四章资料_第4页
第4页 / 共45页
数据库系统基础教程课后答案第四章资料_第5页
第5页 / 共45页
点击查看更多>>
资源描述

《数据库系统基础教程课后答案第四章资料》由会员分享,可在线阅读,更多相关《数据库系统基础教程课后答案第四章资料(45页珍藏版)》请在金锄头文库上搜索。

1、 Solutions Chapter 4 4.1.1 4.1.2 a) b) c) In c we assume that a phone and address can only belong to a single customer (1- m relationship represented by arrow into 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 multiplic

2、ity of above relationships were m-to-n, the entity set becomes weak and the key ssNo of customers will be needed as part of the composite key of the entity set. In c #Components #Relations Min Max Min Max Method straight-E/R a a e e object-oriented a e*a e 2(e-1) nulls e*a e*a 1 1 4.7.1 4.7.2 a) b)

3、c) d) 4.7.3 4.7.4 4.7.5 Males and Females subclasses are complete. Mothers and Fathers are partial. All subclasses are disjoint. 4.7.6 4.7.7 4.7.8 We convert the ternary relationship Contracts into three binary relationships between a new entity set Contracts and existing entity sets. 4.7.9 a) b) c)

4、 4.7.10 A self-association ParentOf for entity set people has multiplicity 02 at parent role end. In a Library database, if a patron can loan at most 12 books, them multiplicity is 012. For a FullTimeStudents entity set, a relationship of multiplicity 5* must exist with Courses (A student must take

5、at least 5 courses to be classified FullTime. 4.8.1 Customers(SSNo,name,addr,phone) Flights(number,day,aircraft) Bookings(row,seat,custSSNo,FlightNumber,FlightDay) Customers(“SSNo“,name,addr,phone) Flights(“number“,“day“,aircraft) Bookings(row,seat,“custSSNo“,“FlightNumber“,“FlightDay“) 4.8.2 a) Mov

6、ies(title,year,length,genre) Studios(name,address) Presidents(cert#,name,address) Owns(movieTitle,movieYear,studioName) Runs(studioName,presCert#) Movies(“title“,“year“,length,genre) Studios(“name“,address) Presidents(“cert#“,name,address) Owns(“movieTitle“,“movieYear“,studioName) Runs(“studioName“,

7、presCert#) b) Since the subclasses are disjoint, Object Oriented Approach is used. The hierarchy is not complete. Hence four relations are required Movies(title,year,length,genre) MurderMysteries(title,year,length,genre,weapon) Cartoons(title,year,length,genre) Cartoon-MurderMysteries(title,year,len

8、gth,genre,weapon) Movies(“title“,“year“,length,genre) MurderMysteries(“title“,“year“,length,genre,weapon) Cartoons(“title“,“year“,length,genre) Cartoon-MurderMysteries(“title“,“year“,length,genre,weapon) c) Customers(ssNo,name,phone,address) Accounts(number,balance,type) Owns(custSSNo,accountNumber)

9、 Customers(“ssNo“,name,phone,address) Accounts(“number“,balance,type) Owns(“custSSNo“,“accountNumber“) d) Teams(name,captainName) Players(name,teamName) Fans(name,favoriteColor) Colors(colorname) For Displays association, TeamColors(teamName,colorname) RootsFor(fanName,teamName) Admires(fanName,play

10、erName) Teams(“name“,captainName) Players(“name“,teamName) Fans(“name“,favoriteColor) Colors(“colorname“) For Displays association, TeamColors(“teamName“,“colorname“) RootsFor(“fanName“,“teamName“) Admires(“fanName“,“playerName“) e) People(ssNo,name,fatherSSNo,motherSSNo) People(“ssNo“,name,fatherss

11、No,motherssNo) f) Students(email,name) Courses(no,section,semester,professorEmail) Departments(name) Professors(email,name,worksDeptName) Takes(letterGrade,studentEmail,courseNo,courseSection,courseSemester) Students(“email“,name) Courses(“no“,“section“,“semester“,professorEmail) Departments(“name“)

12、 Professors(“email“,name,worksDeptName) Takes(letterGrade,“studentEmail“,“courseNo“,“courseSection“,“courseSemester“) 4.8.3 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 bel

13、ong 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. 4.9.1 class Customer (key (ssNo) attribute integer ssNo; attri

14、bute string name; attribute string addr; attribute string phone; relationship Set ownsAccts inverse Account:ownedBy; ; class Account (key (number) attribute integer number; attribute string type; attribute real balance; relationship Set ownedBy inverse Customer:ownsAccts; ; 4.9.2 a) Modify class Acc

15、ount to contain relationship Customer ownedBy (no Set) 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 s

16、tructures and collections recursively. Set 4.9.3 Collections are allowed in ODL. Hence, Colors Set can become an attribute of Teams. class Colors(key(colorname) attribute string colorname; relationship Set FavoredBy inverse Fans:Favors; relationship set DisplayedBy inverse Teams:Displays; ; class Teams(key(name) attribute string name; relationship set Displays inverse Colors:DisplayedBy; relationship set PlayedBy inverse Pl

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 其它办公文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号