Chapter– Problems_第1页
Chapter– Problems_第2页
Chapter– Problems_第3页
Chapter– Problems_第4页
Chapter– Problems_第5页
已阅读5页,还剩1页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、Chapter 3 Problems 8-16.Use the database shown in Figure P3.8 to answer Problems 8-15.FIGURE P3.8 The Ch03_StoreCo Database Tables1. For each table, identify the primary key and the foreign key(s). If a table does not have a foreign key, write None in the space provided.TABLEPRIMARY KEYFOREIGN KEY(S

2、)EMPLOYEEEMP_CODESTORE_CODESTORESTORE_CODEREGION_CODE, EMP_CODEREGIONREGION_CODENONE2. Do the tables exhibit entity integrity? Answer yes or no; then explain your answer.TABLEENTITY INTEGRITYEXPLANATIONEMPLOYEEYesEach EMP_CODE value is unique and there are no nulls.STOREYesEach STORE_CODE value is u

3、nique and there are no nulls.REGIONYesEach REGION_CODE value is unique and there are no nulls.3. Do the tables exhibit referential integrity? Answer yes or no; then explain your answer. Write NA (Not Applicable) if the table does not have a foreign key.TABLEREFERENTIAL INTEGRITYEXPLANATIONEMPLOYEEYe

4、sEach STORE_CODE value in EMPLOYEE points to an existing STORE_CODE value in STORE.STOREYesEach REGION_CODE value in STORE points to an existing REGION_CODE value in REGION and each EMP_CODE value in STORE points to an existing EMP_CODE value in EMPLOYEE.REGIONNA4. Describe the type(s) of relationsh

5、ip(s) between STORE and REGION.Because REGION_CODE values occur more than once in STORE, we may conclude that each REGION can contain many stores. But since each STORE is located in only one REGION, the relationship between STORE and REGION is M:1. (It is, of course, equally true that the relationsh

6、ip between REGION and STORE is 1:M.)5. Create the ERD to show the relationship between STORE and REGION.The Crows Foot ERD is shown in Figure P3.12. Note that each store is located in a single region, but that each region can have many stores located in it. (Its always a good time to focus a discuss

7、ion on the role of business rules in the creation of a database design.)Figure P3.12 ERD for the STORE and REGION Relationship6. Create the relational diagram to show the relationship between STORE and REGION.The relational diagram is shown in Figure P3.13. Note (again) that the location of the enti

8、ties is immaterial the relationships are carried along with the entity. Therefore, it does not matter whether you locate the REGION on the left side or on the right side of the display. But you always read from the “1” side to the “M” side, regardless of the entity location. Figure P3.13 The Relatio

9、nal Diagram for the STORE and REGION Relationship7. Describe the type(s) of relationship(s) between EMPLOYEE and STORE. (Hint: Each store employs many employees, one of whom manages the store.)There are TWO relationships between STORE and REGION. The first relationship, expressed by STORE employs EM

10、PLOYEE, is a 1:M relationship, because one store can employ many employees and each employee is employed by one store. The second relationship, expressed by EMPLOYEE manages STORE, is a 1:1 relationship, because each store is managed by one employee and an employee manages only one store.NOTEIt is u

11、seful to introduce several ways in which the manages relationship may be implemented. For example, rather than creating the manages relationship between EMPLOYEE and STORE, it is possible to simply list the manager's name as an attribute in the STORE table. This approach creates a redundancy whi

12、ch may not do much damage if the information requirements are limited. However, if it is necessary to keep track of each manager's sales and personnel management performance by store, the manages relationship we have shown here will do a much better job in terms of information generation. Also,

13、you may want to introduce the notion of an optional relationship. After all, not all employees participate in the manages relationship. We will cover optional relationships in detail in Chapter 4, “Entity relationship (ER) Modeling.”8. Draw the ERD to show the relationships among EMPLOYEE, STORE, an

14、d REGION.The Crows Foot ERD is shown in Figure P3.15. Remind students that you always read from the “1” side to the “M” side in any 1:M relationship, i.e., a STORE employs many EMPLOYEEs and a REGION contains many STORES. In a 1:1 relationship, you always read from the “parent” entity to the related

15、 entity. In this case, only one EMPLOYEE manages each STORE and each STORE is managed by only one EMPLOYEE.We have shown Figure P3.15s Visio Professional-generated ERD to include the properties of the manages relationship. Note that there is no mandatory 1:1 relationship available at this point. Tha

16、ts why there is an optional relationship the O symbol next to the STORE entity to indicate that an employee is not necessarily a manager. Let your students know that such optional relationships will be explored in detail in Chapter 4. (Explain that you can create mandatory 1:1 relationships when you add attributes to the entity boxes and specify a manda

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论