数据库系统概念习题详解:主码与范式应用

需积分: 0 115 下载量 161 浏览量 更新于2024-08-03 14 收藏 684KB DOCX 举报
本资源提供了《数据库系统概念(原书第七版)》课后的习题答案,涵盖了关系数据库设计、主键和外键概念以及SQLDDL(结构化查询语言数据定义语言)的应用。以下是部分内容的详细解析: 1. 关系模型中的主码识别:题目涉及了如何确定关系中的主键,这是数据库设计的基础。例如,职工表中,由于每个职工的姓名是唯一的,所以姓名可以作为主码;工作表中,因为每个工作对应一个特定的职工和公司,所以组合键(姓名和公司名)是主码;公司表中,公司名也是唯一标识,单独作为主码。对于银行数据库,各个表中的主码分别为:支行的支行名,客户的客户名,贷款的贷款号。 2. 外键的使用:题目要求确定外码,即引用其他表的主键来建立关联。例如,贷款人表通过客户名和贷款号引用客户表,账户和储户表分别通过客户名和账号引用客户表。外码的设置确保了数据的完整性和一致性。 3. 多对多关系的理解:在advisor关系中,一个学生可能有多个指导教师,这表明单个s_id不能唯一标识一条记录,因此需要一个组合键(s_id和i_id)作为主码。 4. SQLDDL示例:针对教材中的保险公司数据库,题目要求编写SQLDDL来创建数据模式。比如,person表的主键是driver_id,car表的主键是licence,accident表的主键是report_number。在DDL中,除了定义主键外,还应合理地指定数据类型,如VARCHAR2、NUMERIC等。 这些习题旨在帮助读者理解数据库的基本概念,包括实体关系模型(ER图)、数据独立性原则,以及如何用SQLDDL来定义和管理数据库模式。通过解答这些问题,学生可以加深对关系数据库理论、设计原则和SQL语言的实践应用的掌握。
2018-06-18 上传
数据库系统概念(杨冬青)习题答案Chapter 1 provides a general overview of the nature and purpose of database systems. The most important concept in this chapter is that database systems allow data to be treated at a high level of abstraction. Thus, database systems differsignificantly from the file systemsand general purpose programming environments with which students are already familiar. Another important aspect of the chapter is to provide motivation for the use of database systems as opposed to application programs built on top of file systems. Thus, the chapter motivates what the student will be studying in the rest of the course. The idea of abstraction in database systems deserves emphasis throughout, not just in discussion of Section 1.3. The overview of the structure of databases is, of necessity, rather brief, and is meant only to give the student a rough idea of some of the concepts. The student may not initially be able to fully appreciate the concepts described here, but should be able to do so by the end of the course. The specifics of the E-R, relational, and object-oriented models are covered in later chapters. These models can be used in Chapter 1 to reinforce the concept of abstraction, with syntactic details deferred to later in the course. If students have already had a course in operating systems, it is worthwhile to point out how the OS and DBMS are related. It is useful also to differentiate between concurrency as it is taught in operating systems courses (with an orientation towardsfiles, processes,and physical resources)and database concurrency control (with an orientation towards granularity finer than the file level, recoverable transactions, and resources accessed associatively rather than physically). If students are familiar with a particular operating system, that OS’s approach to concurrent file access may be used for illustration.