ImageVerifierCode 换一换
格式:DOCX , 页数:19 ,大小:36.82KB ,
资源ID:8149337      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8149337.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(数据库ER图练习及答案.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

数据库ER图练习及答案.docx

1、数据库ER图练习及答案DB Modeling Exam PracticalAnswer the following questions、1. Create an E-R schema for a database system used to manage account information at a community bank、 The bank has several branches with unique names、 A customer may have one or more accounts in one or more branches、 An account must

2、 belong to one and only one branch、 Each account is operated on by transactions, which may be deposits to or withdrawals from some account、 The database keeps track of all the transactions on each account, in addition to the balance of individual accounts and the assets of individual branches、 For e

3、ach entity, specify all its attributes, primary key, and alternate key(s)、 In your ER schema, be sure to capture the cardinality constraints and participation constraints of all relationships、 Make reasonable assumptions to complete the specification、 Explicitly state all your assumptions、 EVERY con

4、struct in your ER schema should be substantiated by either the specification above or your explicit assumptions、2. The following table stores information about which suppliers can supply which parts、 The table captures the fact that a part whose name is PartName and whose ID is PartID can be supplie

5、d by suppliers whose names are in SupplierName and whose IDs are in SupplierID、 Note that a part can be supplied by many suppliers, and a supplier can supply many parts、 CAN_SUPPLYPartIDPartNameSupplierIDSupplierName1234Nut223ProMetal1234Nut224Biscayne2134Bolt223ProMetal3. Perform the following task

6、s、1. List the primary key、 2. List all the FDs、 3. What normal form is the relation in? Explain、 4. Apply normalization to it incrementally, carrying the normalization process through each of the higher normal forms possible up to 3NF、 That is, if the relation were unnormalized, bring it to first no

7、rmal form, then bring the first normal form youve just created to second normal form, and then bring the second normal form to third normal form、 For each transformation to the next higher normal form X, Explain the steps you took to bring it to the normal form X、 Provide the normal form Xs table st

8、ructure, primary key(s), and the FDs、 Explain why you think it is in the normal form X、 For example, if you think there is a partial dependency, fully defend your conclusion by explaining how a column is partially dependent on some other column(s)、 That is, if the relation were in an unnormalized fo

9、rm, you would explain the transformation you performed to bring it to first, second, and third normal forms、 You would also provide the table structure, the primary key and the FDs for the first, second, and third normal forms、 You would also provide explanation for why you believe it is in first, s

10、econd, and third normal forms、 4. Convert the following E-R schema into a relational schema using the mapping algorithm specified in this course、 Specify key and referential integrity constraints, using directed arcs、 Make sure you also identify alternate keys、 Label each step of the mapping algorit

11、hm、 Answer:1、BankAccountCustomerTransactionBranchBankNameBankPhoneBranchAddrBranchNameHasN1BranchPhoneAssetsCustNamePhoneNumCustIDAccountNoBalanceOperationTypeTIDTDateTimeAofBranchTofAccountOpen1NM11NEntity:1. Bank(BankName,BankPhone) (BankPhone is a multi-valued attribute、)PK: (BankName)2. Cutomer(

12、CustID, CustName, PhoneNum)PK: (CustID)AK: (PhoneNum)3. Branch (BranchName, BranchAddr, BranchPhone, Assets) (BranchPhone is a multi-valued attribute、)PK: ( BranchName)4. Account (AccountNo, Balance)PK: (AccountNo)5. Transaction (TID, OperationType, TDateTime)PK: (TID)Relations:1. Has: , 1:N, PARTIA

13、L/ TOTAL;2. Open: , 1:N, PARTIAL/ TOTAL;3. AofBranch: , 1:N, PARTIAL/ TOTAL;4. TofAccount: , 1:N, PARTIAL/ TOTAL;Assumptions:1. A new bank can establish no branch、2. One normal bank establishes one or more braches、3. A bank has one or more telephones for customers、4. A customer can open one or more

14、Account、5. An account must belong to one and only one branch、 6. One branch opens one or more accounts、7. A branch has one or more telephones for customers、8. An account belongs to just one branch;2、1、pk:(PartID, SupplierID)2、FDs:FD1: PartID-PartNameFD2: SupplierID-SupplierName3、 The relation is in

15、the first normal form(1NF)、 Each attribute of the relation allows a single atomic value, so it is in 1NF、But some none-primary-key attributes, such as PartName and SupplierName, partially dependant on the primary key (as FD1 and FD2 show), so it is not in 2NF、4、 Normalization:1) FD1: PartID-PartName

16、 The relation can be decomposited into two relations:PART(PartID, PartName),FDs=PartID-PartName, PK:(PartID);CAN_SUPLY(PartID, SupplierID, SuplierName), FDs=SupplierID-SupplierName), PK:(PartID,SupplierID)、 The relation PART is now in the third normal form because the only none-primary-key attribute

17、 PartName, fully (not partially) and directly (not transively) dependants on the primary key PartId、 The relation CAN_SUPPLY is still in the first normal because the only none-primary-key attribute SupplierName, partially dependants on the primary key (PartId,SupplierID)、2)CAN_SUPLY(PartID, Supplier

18、ID, SuplierName), FDs=SupplierID-SuplierName): For SupplierID-SuplierName, the relation can be decomposited into two relations:SUPPLIER(SupplierID,SupplierName),FDs=SupplierID-SuplierName, PK:(SupplierID);CAN_SUPLY(PartID, SupplierID), FDs=, PK:(PartID,SupplierID)、 Both relations are in the third no

19、rmal form, because for each one, no none-primary-key attribute patially or transively dependants on its primary key、3) Three 3NF relations:PART(PartID, PartName),FDs=PartID-PartName, PK:(PartID);SUPPLIER(SupplierID,SupplierName),FDs=SupplierID-SuplierName, PK:(SupplierID);CAN_SUPLY(PartID, SupplierI

20、D), FDs=, PK:(PartID,SupplierID)、3、九步算法:三种异常:修改异常、插入异常、删除异常。S1:每一强实体用一个新表表示S2:处理参与1:1标识联系的弱实体WS3:处理参与1:N标识联系的弱实体WS4:处理每一二元1:1联系R,确定参与该联系的实体型对应的表S与T,将T的主码作为外码加入S,将R的所有简单属性与复合属性成分作为列加入S。S5:处理每一二元1:N联系R,确定处于N端的实体表S与1端的实体表T,将T的主码作为外码加入S,将R的所有简单属性与复合属性成分作为列加入S、S6:处理每一N元联系(包括二元M:N联系),对应新表T,将R的所有简单属性与复合属性成

21、分作为列加入T,将参与联系的(强、弱)实体型的主码作为外码加入T,所有外码组合,共同构成T的主码、S7:处理每一多值属性A,将A的所有简单属性与复合属性成分作为列加入T,将A所属的实体或联系型的主码作为外码加入T,将(上步得到的)外码与A对应的属性确定为T的主码、S8:处理每一非相交子类的特化、S9:处理每一相交子类的特化、S1:T1: Coach(Name,Age) PK:(Name)T2: Team(Name) PK:(Name)T3: Player(Name,Age) PK:(Name)T4: Game(Number,Score,Time,Date) PK:(Number)T5: Sta

22、dium(Name,Size,Location) PK:(Name)S2:处理参与1:1标识符联系的弱实体S3:处理参与1:N标识符联系的弱实体S4:T2: Team(Name,CoachName) PK:(Name) FK:CoachName references Coach(Name)S5:T3: Player(Name,Age,TeamName) PK:(Name) FK:TeamName references Teach(Name)S6:T6: Practice(TeamName,StadiumName,Date) PK:(TeamName,StadiumName) FK:TeamNa

23、me references Teach(Name) FK:StadiumName references Stadium(StadiumName)T7: PlaysWith(HostName,VisitorName,GameNumber) PK:(GameNumber) FK:HostName references Team(name) FK:VisitorName references Team(name)S7:T8: TeamColor(TeamName,color) PK:(TeamName,color) FK:TeamName references Team(name)The last

24、seven tables:T1: Coach(Name,Age) PK:(Name)T2: Team(Name,CoachName) PK:(Name) FK:CoachName references Coach(Name)T3: Player(Name,Age,TeamName) PK:(Name) FK:TeamName references Teach(Name)T4: Game(Number,Score,Time,Date) PK:(Number)T5: Stadium(Name,Size,Location) PK:(Name)T6: Practice(TeamName,Stadium

25、Name,Date) PK:(TeamName,StadiumName) FK:TeamName references Teach(Name) FK:StadiumName references Stadium(StadiumName)T7: PlaysWith(HostName,VisitorName,GameNumber) PK:(GameNumber) FK:HostName references Team(name) FK:VisitorName references Team(name)t8: TeamColor(TeamName,color) PK:(TeamName,color)

26、 FK:TeamName references Team(name)(T4 and T7 have the same primary key, so, they can be joined to a new table、)NormalizationProvide your solution to the following in a normalization、txt、 Note: The discussion in this exercise is independent of (i、e、, completed unrelated to) the E-Commerce project des

27、cribed in the Appendix、The following table captures the following fact about an E-Commerce bookstore: the employee whose name is EmpName and whose ID is EmpID has shipped the order (whose Order Number is OrderNo) to the address ShipToAddr on the date ShippedDate、 The tracking number for the shipment

28、 is TrackingNum、 The TrackingNum is provided by the courier company that picks up the shipment、 The bookstore uses only one courier company、 Note that a single order could be split up into multiple shipments based on the availability of the ordered items、 Only one employee handles a shipment、 Howeve

29、r, multiple employees could handle an order if the order is shipped in multiple shipments、 SHIPMENTEmpIDEmpNameOrderNoShipToAddrShippedDateTrackingNum1234Joe2234615 Forbes Ave, Pittsburgh, PA 1514712/21/99124356782134Jones2244615 Forbes Ave, Pittsburgh, PA 1514712/25/99213456781. List the primary ke

30、y、 2. List all the FDs、 3. List all the update anomalies and provide an example of each、 4. What normal form is the relation in? Explain、 5. Apply normalization to it incrementally, bringing the relation to 3NF、 That is, if the relation is unnormalized, bring it to first normal form, then bring the

31、first normal form youve just created to second normal form, and then bring the second normal form to third normal form、 For each transformation to the next higher normal form X, o Explain the steps you took to bring it to the normal form X、 o Provide the normal form Xs table structure, primary key(s), and the FDs、 o Explain why you think it is in the normal form X、 That is, if the relation

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1