2014数据库系统期末试题及答案

合集下载

数据库系统概论期末试题及答案(整理版)

数据库系统概论期末试题及答案(整理版)

《数据库原理及应用》试题 1■、选择题1、 数据库系统的基本特征是 ________ 。

A 、数据的统一控制C 、数据共享性、独立性和冗余度小 (难度系数C )正确答案:C2、 DB 、DBMS 和DBS 三者之间的关系是A 、DBS 与DB 和DBMS 无关C 、DB 包括 DBMS 和 DBS(难度系数B )正确答案:D3、设有关系R 和S ,关系代数 R -(R -S )表示的是 _____________ 。

A 、R Q SB 、R — SC 、R -SD 、R U S(难度系数B )正确答案:A4、自然连接是构成新关系的有效方法。

一般情况下,当对关系R 和S 使用自然连接时,要求 R 和S 含有一个或多个共有的 ____________ 。

A 、行B 、属性C 、记录D 、元组(难度系数C )正确答案:B5、 以下是信息世界的模型,且实际上是现实世界到机器世界的一个中间层 次的是 _________ 。

A 、数据模型 B 、概念模型 C 、关系模型D 、E-R 图(难度系数C )正确答案:C6、 构成E — R 模型的三个基本要素是 ________ 。

A 、实体、属性值、关系;B 、实体、属性、联系;C 、 实体、实体集、联系;D 、实体、实体集、属性;(难度系数C )正确答案:B7、 在关系代数运算中,五种基本运算为 __________ 。

A 、并、差、选择、投影、连接 B 、 并、交、选择、投影、笛卡尔积 C 、并、差、选择、投影、笛卡尔积D 、 并、除、投影、笛卡尔积、选择(难度系数B )正确答案:CB 、数据共享性和统一控制D 、数据共享性和数据独立性B 、DBMS 包括 DBS 和 DB D 、DBS 包括 DB 和 DBMS&在下列关于规范化理论的叙述中,不正确的是_____________ 。

A、任何一个关系模式一定有键。

SDETP char(12) check (SDEPT IN( IS','MA','CS')))13、允许取空值但不允许出现重复值的约束是 ____________A 、NULLB 、PRIMARY KEYC 、UNIQUED 、FOREIGN KEY(难度系数B )正确答案:CA 、 ( 'T0203' ,'刘刚’, NULL , NULL , IS 'B 、 ( NULL ,王芳’, '女’,‘ 1200',‘ CS ')C 、 ( 'T0111' ,NULL ,'男’,23,‘ MA ') D 、( 'T0101' ,'李华’ ,男,2100, ‘ EN ' )o可以插入到Teacher 表中的元组是(难度系数A )正确答案:A12、SQL 语言中,条件年龄 BETWEEN 18 AND 30表示年龄在18至30之间,B 、 任何一个包含两个属性的关系模式一定满足C 、 任何一个包含两个属性的关系模式一定满足D 任何一个包含三个属性的关系模式一定满足(难度系数B )正确答案:D9、 设有关系模式 R(A,B,C)和S(C,D)。

2013-2014学年度上学期数据库ACCESS期末考试卷100

2013-2014学年度上学期数据库ACCESS期末考试卷100

2013-2014学年度上学期数据库ACCESS期末考试卷100○ ○ 线号题学○ 答订要○ 不装:内○ 名姓线封○封密密○:级班○ 2013-2014学年度上学期数据库ACCESS期末考试卷(考试时间:90分钟,满分:100分)题号第一题第二题第三题总分得分一、选择题(本大题共40小题,每小题1.5分,共60分)得分评卷1、Access2003的数据库文件格式是()(A)dot文件(B)XLS文件(C)txt文件(D)mdb文件2、Access2003的数据类型是()(A)关系数据库(B)面向对象数据库(C)层次数据库(D)网状数据库3、在关系数据库中,能够惟一地标识一个记录的属性或属性的组合,称为( ) (A)关键字(B)属性(C)关系(D)域4、在Access中,用来表示实体的是()(A)记录(B)表(C)域(D)字段5、在关系模型中,用来表示实体关系的是()(A)表(B)指针(C)字段(D)记录6、从关系模式中,指定若干属性组成新的关系称为()(A)选择(B)投影(C)联接(D)自然联接7、在数据管理技术的发展过程中,经历了人工管理阶段、文件系统阶段和数据库系统阶段。

其中数据独立性最高的阶段是()(A)数据库系统(B)文件系统(C)人工管理(D)数据项管理8、将两个关系拼接成一个新的关系,生成的新关系中包含满足条件的元组,这种操作称为()(A)选择(B)投影(C)连接(D)并9、在超市营业过程中,每个时段要安排一个班组上岗值班,每个收款口要配备两名收款员配合工作,共同使用一套收款设备为顾客服务。

在数据库中,实体之间属于一对一关系的是()(A)“顾客”与“收款口”的关系(B)“收款口”与“收款员”的关系(C)“班组”与“收款员”的关系(D)“收款口”与“设备”的关系在Access 数据库对象中,体现数据库设计目的的对象是()。

(A)报表(B)模块(C)查询(D)表10、Access数据库最基础的对象是( ) (A)表(B)宏(C)报表(D)查询11、下列对主关键字段的叙述,错误的是()(A)数据库中的每个表都必须有一个主关键字段(B)主关键字段值是惟一的(C)主关键字可以是一个字段,也可以是一组字段(D)主关键字段中不许有重复值和空值12、如果字段内容为声音文件,则该字段的数据类型应定义为()(A)超级链接(B)OLE 对象(C)文本(D)备注13、在Access数据库的表设计视图中,不能进行的操作是()(A)增加字段(B)删除记录(C)修改字段类型(D)设置索引14、Access数据库中,为了保持表之间的关系,要求在子表(从表)中添加记录时,如果主表中没有与之相关的记录,则不能在子表(从表)中添加该记录。

2014年10月全国自考数据库及其应用真题试卷_真题(含答案与解析)-交互

2014年10月全国自考数据库及其应用真题试卷_真题(含答案与解析)-交互

2014年10月全国自考(数据库及其应用)真题试卷(总分86, 做题时间90分钟)1. 单项选择题1.在数据库系统中,数据的正确性和一致性称为数据的 ( )SSS_SINGLE_SELA 完整性B 并发控制C 安全性D 恢复该问题分值: 2答案:A解析:数据的完整性是指数据的正确性和一致性。

2.用来表达用户使用观点的数据库局部逻辑结构,称为 ( )SSS_SINGLE_SELA 概念模型B 逻辑模型C 外部模型D 内部模型该问题分值: 2答案:C解析:用来表达用户使用观点的数据库局部逻辑结构的模型称为外部模型。

3.有学生(学号,姓名,性别,班级号)和班级(班级号,班级名称,专业)两个关系,下列说法中正确的是 ( )SSS_SINGLE_SELA 班级关系的外键是“班级号”B 学生关系的主键是“班级号”C 学生关系的外键是“班级号”D 学生关系的主键是“姓名”该问题分值: 2答案:C解析:在关系中凡能唯一标识元组的属性,称为关系模式的候选键。

用户从候选键中选做标识元组的属性称为主键。

如果关系模式R中属性K是其他关系模式的主键,那么K在R中称为外键。

本题中,学生关系的主键是学号,外键是班级号;班级关系的主键是班级号,没有外键。

4.在关系模式R(A,B,C,D)中,有函数依赖A→B,A→D,B→C,则R的规范化程度能达到 ( )SSS_SINGLE_SELA 1NFB 2NFC 3NFD BCNF该问题分值: 2答案:B解析:所谓函数依赖是指关系中属性之间取值的依赖情况。

如果关系模式R的每个关系r的属性值都是不可分的原子值,那么称R为第一范式(1NF)。

显然,本题的关系模式R满足1NF。

对于满足1NF的关系,通过消除非主属性对主键的部分函数依赖,使之达到2NF。

所谓部分依赖指属性C只依赖于主键中的B,而与A无关。

可知本题的关系模式R满足2NF。

对于满足2NF关系,如果不存在非主属性对主键的传递函数依赖,则称属于3NF关系。

数据库期末考试试题及答案

数据库期末考试试题及答案

数据库期末考试试题及答案一、选择题(每题2分,共20分)1. 在关系数据库中,用来表示实体之间关系的是:A. 属性B. 关系C. 键D. 表答案:B2. SQL语言中的“SELECT”语句用于:A. 插入数据B. 更新数据C. 查询数据D. 删除数据答案:C3. 数据库管理系统(DBMS)的主要功能不包括:A. 数据存储B. 数据查询C. 数据备份D. 数据加密答案:D4. 以下哪个不是数据库设计中的范式:A. 第一范式(1NF)B. 第二范式(2NF)C. 第三范式(3NF)D. 第四范式(4NF)答案:D5. 在数据库中,主键的作用是:A. 唯一标识表中的记录B. 存储数据C. 建立表与表之间的关系D. 排序数据答案:A6. 事务的四大特性不包括:A. 原子性B. 一致性C. 隔离性D. 持久性答案:D7. 以下哪个是数据库的并发控制技术:A. 索引B. 视图C. 锁D. 触发器答案:C8. 数据库的完整性约束包括:A. 实体完整性B. 参照完整性C. 用户定义完整性D. 所有以上答案:D9. 数据库的恢复技术不包括:A. 事务日志B. 检查点C. 数据备份D. 索引答案:D10. 在数据库中,视图的作用是:A. 提高查询速度B. 简化用户操作C. 保护数据D. 存储数据答案:B二、简答题(每题10分,共30分)1. 解释什么是数据库的规范化,并说明其目的是什么?答:数据库的规范化是指按照一定的规则将数据库中的数据组织起来,以减少数据冗余和提高数据的一致性。

其目的是确保数据库的设计是合理的,避免数据的异常,如插入异常、删除异常和更新异常。

2. 描述数据库事务的ACID属性,并解释每个属性的含义。

答:事务的ACID属性包括:- 原子性(Atomicity):事务中的所有操作要么全部完成,要么全部不完成,不会结束在中间某个点。

- 一致性(Consistency):事务必须保证数据库从一个一致的状态转移到另一个一致的状态。

《数据库系统》期末考试以及答案

《数据库系统》期末考试以及答案

计算机科学系《数据库系统》期末考试一、单项选择体(本大题共20小题,每小题1分,共20分)1.数据库的概念模型独立于( D )。

A.现实世界B.E-R图C.信息世界D.具体的机器和DBMS2.下述关于数据库系统的正确叙述是( A )。

A.数据库系统减少了数据冗余B.数据库系统避免了一切冗余C.数据库系统中数据的一致性是指数据类型一致D.数据库系统比文件系统能管理更多的数据3.在数据库技术中,为提高数据库的逻辑独立性和物理独立性,数据库的结构被划分成用户级、( C )和存储级三个层次。

A.管理员级 B.外部级 C.概念级 D.内部级4.数据库管理系统是( B )。

A.操作系统的一部分B.在操作系统支持下的系统软件C.一种编译程序D.一种操作系统5.按所使用的数据模型来分,数据库可分为( A )三种模型。

A.层次、关系和网状B.网状、环状和链状C.大型、中型和小型D.独享、共享和分时6. 数据库系统3层结构的描述存放在( D )中。

A.数据库B.运行日志C.数据库管理系统D.数据字典7.在数据库的三级模式结构中,描述数据库中全体数据的全局逻辑结构和特征的是( D )。

A.外模式B.内模式C.存储模式D.逻辑模式8.数据库管理系统能实现对数据库中数据的查询、插入、修改和删除等操作.这种功能称为( C )。

A.数据定义功能B.数据管理功能C.数据操纵功能D.数据控制功能9. ( A )是数据库系统的基础。

A.数据模型B.数据库C.数据库管理系统D.数据库管理员10. 在数据库技术中,实体-联系模型是一种( D )。

A. 逻辑数据模型B. 物理数据模型C. 结构数据模型D. 概念数据模型11. 在关系数据库设计中,设计关系模式是( C )的任务。

A.需求分析阶段B.概念设计阶段C.逻辑设计阶段D.物理设计阶段12.数据库三级模式体系结构的划分,有利于保持数据库的( A )。

A.数据独立性B.数据安全性C.结构规范化D.操作可行性13.在数据库中,产生数据不一致的根本原因是( D )。

数据库期末考试试题及答案

数据库期末考试试题及答案

数据库期末考试试题及答案一、选择题(每题2分,共20分)1. 在关系数据库中,用于查询数据的SQL语句是:A. SELECTB. UPDATEC. INSERT INTOD. DELETE2. 下列哪个不是数据库的三大范式之一?A. 第一范式(1NF)B. 第二范式(2NF)C. 第三范式(3NF)D. 第四范式(4NF)3. 以下哪个选项不是数据库设计阶段的任务?A. 需求分析B. 概念设计C. 逻辑设计D. 物理设计4. 在数据库中,用于更新表中数据的SQL语句是:A. SELECTB. UPDATEC. DELETED. INSERT INTO5. 以下哪个是数据库事务的四大特性之一?A. 原子性(Atomicity)B. 一致性(Consistency)C. 隔离性(Isolation)D. 持久性(Durability)二、简答题(每题10分,共30分)1. 简述数据库管理系统(DBMS)的主要功能。

2. 解释什么是外键,并说明其在数据库中的作用。

3. 描述数据库备份和恢复的重要性及基本步骤。

三、应用题(每题25分,共50分)1. 假设你是一个数据库管理员,需要为一个在线书店设计数据库。

请列出至少五个实体,并为每个实体设计至少三个属性。

2. 给定以下SQL查询语句:```SELECT AuthorName, COUNT(*) AS BookCountFROM BooksJOIN Authors ON Books.AuthorID = Authors.AuthorIDGROUP BY AuthorNameORDER BY BookCount DESC;```请解释该查询语句的功能,并描述其可能的输出结果。

四、案例分析题(共30分)假设你负责维护一个大学的学生信息系统。

请根据以下场景回答问题:1. 描述如何使用SQL语句添加一个新学生记录。

2. 如果需要查询所有计算机科学系学生的姓名和学号,应使用什么SQL查询语句?3. 假设系统需要支持学生选课功能,描述如何设计相应的数据库表和关系。

数据库期末考试试题及答案

数据库期末考试试题及答案一、单项选择题(每题2分,共20分)1. 数据库管理系统(DBMS)是()。

A. 一组软件B. 一个数据库C. 一组硬件D. 一个操作系统答案:A2. 在关系数据库中,关系是指()。

A. 行的集合B. 列的集合C. 行和列的有序对集合D. 行和列的无序对集合答案:C3. SQL是()。

A. 数据定义语言B. 数据控制语言C. 数据操纵语言D. 结构化查询语言答案:D4. 数据库系统的核心是()。

A. 数据模型B. 数据库管理系统C. 数据库D. 应用程序答案:C5. 数据库设计中,视图设计属于()。

A. 概念性设计B. 逻辑设计C. 物理设计D. 实体-关系模型设计答案:B6. 在关系数据库中,一个关系至少有一个候选键,一个候选键可以有()个属性。

A. 一个B. 多个C. 零个D. 任意个答案:B7. 数据库管理系统能提供数据的()。

A. 物理独立性B. 逻辑独立性C. 数据独立性D. 以上都是答案:D8. 数据库中,存储数据的基本单位是()。

A. 记录B. 字段C. 表D. 文件答案:C9. 数据库系统与文件系统相比,数据库系统能够提供()。

A. 数据共享B. 数据独立性C. 数据完整性D. 以上都是答案:D10. 在数据库中,数据的完整性约束不包括()。

A. 实体完整性B. 参照完整性C. 用户定义的完整性D. 数据冗余答案:D二、填空题(每题2分,共20分)1. 数据库系统由数据库、数据库管理系统和_________组成。

答案:数据库应用程序2. 数据库系统的核心是_________。

答案:数据库3. 数据库管理系统的主要功能包括数据定义、数据操纵、数据控制和_________。

答案:事务管理4. 在关系数据库中,关系模式的每一个分量称为_________。

答案:属性5. 数据库设计分为概念性设计、_________设计和物理设计三个阶段。

答案:逻辑6. 在数据库中,_________是指关系中的列。

数据库期末考试试题及答案

1】文件组 . 数据库期末考试试题一、填空 共 30 题 (共计 30 分)第 1 题 (分) 题号 :2385ORDER BY 子句实现的是【1】.答案:=======(答案 1)======= 排序第 2 题 (分) 题号 :2374 如果列上有约束 , 要删除该列 ,应先删除【 1】 答案:=======(答案 1)======= 相应的约束第 3 题 (分) 题号 :2394在每次访问视图时 ,视图都是从【 1 】中提取所包含的行和列 答案:=======(答案 1)======= 基表第 4 题 (分) 题号 :23721 .在增加数据文件时 ,如果用户没有指明文件组 ,则系统将该数据文件增加到【 答案:=======(答案 1)=======主第 5 题 (分) 题号 :2371查看XSCJ 数据库信息的存储过程命令是【1】 答案:=======(答案 1)=======sp_helpdb第 6 题(分)题号 :2392创建视图定义的 T-SQL 语句的系统存储过程是【 1】答案: =======(答案 1)======= sp_helptext第 7 题(分)题号 :23791. 表的外键约束实现的是数据的【 1】完整性 . 答案:=======(答案 1)======= 参照第 8 题(分)题号 :2390要进行模糊匹配查询 , 需要使用【 1】关键字来设置查询条件答案:=======(答案 1)=======LIKE第 9 题(分)题号 :2380 定义标识列的关键字是【 1】. 答案:=======(答案 1)=======identity第 10 题(分)题号 :2383 在进行多表查询是 , 必须设置【 1】条件 . 答案:=======(答案 1)======= 连接第 11 题(分)题号 :2363 联系两个表的关键字称为【 1】答案: =======(答案 1)======= 外键第 12 题(分)题号 :2382 用【 1】字句可以实现选择行的运算答案:=======(答案 1)======= WHERE第 13 题(分)题号 :2391如果要加密视图的定义 , 可以在创建视图时使用【 1】关键字 . 答案:=======(答案 1)=======WITH ENCRYPTION第 14 题(分)题号 :2386SQL 2012采用的结构化查询语言称为【 1】答案:=======(答案 1)=======Transact-SQL第 15 题(分)题号 :2362 数据库系统中所支持的主要逻辑数据模型有层次模型、关系模型、【1】和面向对象模型答案:=======(答案 1)=======网状模型第 16 题(分)题号 :2360DBMS数据库管理系统)通常提供授权功能来控制不同的用户访问数据库中数据的权限,其目的是为了数据库的【 1】答案:=======(答案 1)=======安全性第 17 题(分)题号 :2375如果要删除的表 T1是其他表T2的参照表,应先删除表T2中的【1】约束,或者先删除T2表, 在删除 T1 表. 答案:=======(答案 1)======= 外键第 18 题(分)题号 :2393创建视图的T-SQL命令是【1】答案:=======(答案 1)=======CREATE VIEW第 19 题(分)题号 :2369修改数据库的命令是【 1】答案:1】工作 .ALTER DATABASE第 20 题 (分) 题号 :2366 对于 1:n 的联系,关系的键是【 1】 答案:=======(答案 1)=======N 端实体的码第 21 题 (分) 题号 :23651.对于 1:1 的联系 ,每个实体的码均是该联系关系的【 1】 答案:=======(答案 1)======= 候选键 第 22 题 (分) 题号 :23731. 找回被删除表的唯一方法是事先做好数据库的【 答案:=======( 答案 1)======= 备份 第 23 题 (分) 题号 :2387在SELECT 语句查询中,要去掉查询结果中的重复记录,应该使用【1】关键字.答案: =======(答案 1)=======DISTINCT第 24 题 (分) 题号 :2359 数据库系统各类用户对表的各种操作请求(数据库定义、 查询、更新及各种控制 )都是由一个复杂的软件来完成的 , 这个软件叫作【 1】答案:=======(答案 1)=======DBMS第 25 题 (分) 题号 :2376 在一个已存在数据的表中增加不带默认值的列 , 一定要保证所增加的列允许【 1】值 . 答案: =======(答案 1)======= 空第 26 题 (分) 题号 :2367对于m:n 的联系,关系的键是【1】答案:诸实体码的组合第 27 题(分)题号 :2377对表中记录的维护工作主要有增加、【 1 】和删除操作,他们均可以通过对象资源管理器 Transact-SQl 语句完成 .答案: =======(答案 1)======= 修改第 28 题(分)题号 :2389如果列的取消范围是个连接的区间, 可以使用【 1】关键字来设置查询条件答案:=======(答案 1)=======BETWEENAND第 29 题(分)题号 :2384GROUP BY子句实现的是【1】答案:=======(答案 1)======= 分组第 30 题(分)题号 :2368 创建数据库的命令是【 1】答案:=======(答案 1)=======CREATE DATABASE二、判断共 20 题(共计 20 分)第1题(分)题号:2852INSERT语句后面必须要 TITO.答案: N第 2 题(分)题号 :2874使用命令DROP INDE>能删除所有的索引.答案: N第 3 题(分)题号 :2853 制定为标识列后 , 系统自动将该列设定为 NOT NULL.答案: Y 第 4 题(分)题号 :2857用一条INSERT语句一次可以插入多行数据答案: Y 第 5 题(分)题号 :2862在进行连接查询时 , 内连接只把满足条件的记录连接起来并显示出来答案: Y第 6 题(分)题号 :2855 任何数据类型的列都可以设置为标识列答案: N第 7 题(分)题号 :2876 在添加主键约束时 , 系统会自动生成聚集唯一索引 . 答案: Y第 8 题(分)题号 :2846 在数据库中可以没有事务日志文件 , 也可以没有次数据文件 . 答案: N第 9 题(分)题号 :2847修改数据库文件时 , 可以对文件类型、所属文件组和路径进行修改答案: N第 10 题(分)题号 :2845 用户可以创建若干个主文件组 .答案: N第 11 题(分)题号 :2850NULL表示一个空字符串. 答案: N第 12 题(分)题号 :2867在每次访问视图时 , 视图都是从数据表中提取所包含的行和列.答案: Y第 13 题(分)题号 :2870 修改引用表的数据时 , 一定能从视图中反应出来 . 答案: N第 14 题(分)题号 :2873 索引既可以提高检索数据的速度 , 也可以提高修改数据的速度 .答案: N 第 15 题(分)题号 :2860AND运算符和"BETWEEN…AND运算符都能设置值范围是连接区间的逻辑条件答案: Y第 16 题(分)题号 :2866 子查询内不能再嵌套子查询 . 答案: N第 17 题(分)题号 :2865表达式 ">=ALL(2,4,6)" 与">=2" 等价 . 答案: N第 18 题(分)题号 :2842 创建数据库时 , 不需要指定逻辑名和物理名 . 答案: N第 19 题(分)题号 :2844 事务日志文件不属于任何文件组 . 答案: Y第 20 题(分)题号 :2849 主数据文件不能被删除 , 且日志文件也必须保留一个 . 答案: Y 三、单项选择共 20 题(共计 20 分)第 1 题(分)题号 :7007 数据处理进入数据库系统阶段 , 以下不是这一阶段的优点的是(). A:有很高的数据独立性B: 数据不能共享C :数据整体结构化D: 有完备的数据控制功能答案: B第 2 题(分)题号 :7021在ALTER TABLE语句中使用了()子句可以使表上创建的检查约束暂时无效A:CHECK CONSTRAINTB:NOCHECK CONSTRAINTC:WITH NOCHECKD:DROP CONSTRAINT 答案: B第 3 题(分)题号 :7029 下列关于视图的描述中 ,错误的是()A: 视图不是真实存在的基础表 , 而是一张虚拟表B:当对通过视图查询到的数据进行修改时,相应的引用表的数据也要发生变化C:在创建视图时,若其中某个目标列是聚合函数,必须指明视图的全部列名D:在一个语句中,一次可以修改一个以上的视图对应的引用表答案: D第 4 题(分)题号 :7025 用于自动圣餐唯一的系统值的列属性使()A:NULLB:NOT NULLC:IDENTITYD:SEED答案: C第 5 题(分)题号 :7016SQL Server2012 的物理存储主要包括 3类文件,即()A: 主数据文件、次数据文件、事务日志文件B: 主数据文件、次数据文件、文本文件C :表文件、索引文件、存储文件D:表文件、索引文件、图表文件答案:第 6 题(分)题号 :7006 数据库管理技术的发展阶段不包括()A: 数据库系统管理阶段B :人工管理阶段C :文件系统管理阶段D: 操作系统管理阶段答案: D第 7 题(分)题号 :7010 实体联系图(E-R 图)是()A:现实世界到信息世界的抽象B :描述信息世界的数据模型C:对现实世界的描述D:描述机器世界的数据模型答案: A第 8 题(分)题号 :7020在创建数据库时 , 用来指定数据库文件物理存放位置的参数是() A:FILEGROETH B:FILENAMEC:NAMED:FILE答案: B第 9 题(分)题号 :7034 以下关于索引的正确叙述是().A: 使用索引可以提高数据查询速度和数据更新速度B:使用索引可以提高数据查询速度,但会降低数据更新速度C:使用索引可以提高数据查询速度,对数据更新速度没有影响D:使用索引数据查询速度和数据更新速度均没有影响答案: B第 10 题(分)题号 :7011 关系模型的数据结构是()A: 树B: 图C: 表D:二维码答案:第 11 题(分)题号 :7018 用来显示数据库信息的系统存储过是()A:sp_dbhelpB:sp_dbC:sp_helpD:sp_helpdb答案:第 12 题(分)题号 :7015下面关于Tempdb数据库描述不正确的是(), 应当 ( ).A: 是一个临时数据库B :属于全局资源C :没有权限限制D :是用户建立新数据库的模板答案: D第 13 题 (分) 题号 :7032 为数据表创建索引的目的是 ( ).A:提高查询的检索性能B :创建唯一索引C: 创建主键D :归类答案: A第 14 题 (分) 题号 :7014 当数据库损坏时 , 数据库管理员可通过 ( ) 恢复数据库 . A: 事务日志文件B: 主数据文件C:DELETE 语句D :联机帮助文件答案: A第 15 题 (分) 题号 :7027 部分匹配查询中有关通配符 "_" 的正确描述是 ( ) A:"_" 代表多个字符B:"_" 可以代表零个或多个字符C:"_" 不能与 "%"一同使用D:"_" 代表一个符号答案: D第 16 题 (分) 题号 :7026在分组检索中 , 要去掉不满足条件的记录和不满足条件的分组A:使用WHER 子句B:使用HAVING 子句C:先使用HAVING 子句,在使用WHER 子句D:使用 WHER 子句,在使用 HAVING 子句答案: D第 17 题 (分) 题号 :7013设属性A 是关系R 的主属性,则属性A 不能取空值,这是()A:实体完整性规则B: 参照完整性规则C:用户自定义完整性规则D:域完整性规则答案: A第 18 题(分)题号 :7022SQL Server2012 的字符型系统数据类型主要包括()A:int 、 money、 charB:char 、 varchar 、textC : datemtme 、 binary 、intD:char 、 varchar 、int答案: B第 19 题(分)题号 :7028条件"年领 BETWEEN 20 AND 35" 表示年龄在 20~35 岁,且()A:包括20岁和35岁B: 不包括 20 岁和 35 岁C:包括20岁但不包括35岁D:包括35岁但不包括25岁答案: A第 20 题(分)题号 :7012关系R和S进行自然连接时,要求R和S含有一个或多个公共()A: 元组B: 行C: 记录D:属性答案: D四、程序填空共 5 题(共计 30 分)第 1 题(分)题号 :177在KC 表中,统计每学期的总学分select 开课学期 , 【】 as 每学期的总学分 from kc ******** *SPACE***************** *SPACE*********】开课学期答案:=======(答案 1)=======sum(学分)=======(答案 2)======= group by 第 2 题(分)题号 :170 在XS_KC表中,查询在90分以上和不及格学生的信息******** *SPACEselect 【】 , 课程号 , 成绩from xs_kc******** *SPACEwhere 【】成绩 <60 答案: =======(答案 1)======= 学号 =======(答案 2)======= 成绩 >=90 or第 3 题(分)题号 :179******** *SPACE将XS_KC表中的数据记录按学号分类汇总,输出学号和平均分select 学号 , 【】 as 学生的平均分from xs_kc******** *SPACE】学号答案: =======(答案 1)======= avg(成绩)=======(答案 2)======= group by******** *SPACE3 位为 6 或 9 的记录信息 ******** *SPACE******** *SPACE******** *SPACE第 4 题 (分) 题号 :634在XSQK 表中,查询个专业的学生人数 select 专业名 ,】 各专业人数 from xsqk】 专业名 答案: =======( 答案 1)======= count ( 专业名 ) as=======( 答案 2)======= group by 第 5 题 (分) 题号 :174在XSQK 表中,查询电话号码第from 【】】 联系电话 like ‘ __[69]% ' 答案:=======( 答案 1)=======select =======( 答案 2)======= xsqk( 答案 3)where ******** *SPACE *********。

数据库2013-2014第一学期期末试卷A卷答案

上海应用技术学院2012—2013学年第2学期《信息系统与数据库技术》期末(B)试卷答案一、单项选则题(20分,每小题1分)BDACC DCBAA二、简答题(40分,每小题4分)1.关系模型的完整性约束条件有哪些?域完整性,实体完整性,参照完整性(1) 域完整性规定了属性的值必须是属性值域中的值。

域完整性又称为用户自定义完整性。

它是在关系数据模型定义时,由用户对属性列值的数据类型、长度、单位、精度、格式、值域范围、是否允许为“空值”等进行限定。

(2) 实体完整性是指关系中的元组在组成主关键字的属性上不能有空值且主关键字的值不能相同。

(3) 参照完整性要求一个外表的外关键字的取值必须是其主表主关键字的存在值或空值。

2.请简述等值联接和自然联接的区别和联系。

连接操作是二元运算,从两个关系的笛卡儿积中选取满足一定条件的元组。

当连接条件中的运算符为“=”时,称为等值连接。

如果等值连接中连接属性为相同属性(或属性组),而且在结果关系中去掉重复属性,则等值连接称为自然连接。

3.简述数据库设计的基本步骤,数据库设计的特点。

数据库设计的基本步骤:1)需求分析:了解和分析用户的应用需求(包括信息需求和处理需求),进行需求收集和分析,并以数据流图、数据字典等形式加以描述。

2)概念设计:把需求分析阶段得到的用户需求进行综合、归纳和抽象,形成一个独立于具体DBMS 的概念数据模型。

3)逻辑设计:按照一组转换规则,将概念设计阶段产生的概念模型转换为某个DBMS支持的逻辑数据模型。

4)物理设计:是为逻辑模型选取一个最适合应用环境的物理结构(包括存取结构和存取方法)。

5)数据库实施:设计人员运用DBMS提供的数据库语言及其宿主语言,根据逻辑设计和物理设计的结果建立数据库,编制与调试应用程序,组织数据入库,并进行试运行。

6)数据库运行与维护:数据库试运行后,即可投入正式运行。

数据库在运行期间应不断地对其进行评价、调整与修改。

数据库设计的特点:1)反复性:数据库设计不可能一气呵成,需要反复推敲和修改才能完成。

2014数据库系统期末试题及答案

华南农业大学期末考试试卷(A卷)2014-2015学年第一学期考试科目:数据库系统考试类型:闭卷考试时间:120 分钟学号姓名年级专业Question 1: true-false question (15 points) For each of the following statements, indicate whether it is TRUE or FALSE (Using √for TRUE and ×for FALSE). You will get 1 point for each correct answer, -0.5 point for each incorrect answer, and 0 point for each answer left blank. Be sure to write your answer in the answer sheet.1. A primary key is a field (or group of fields) that uniquely describes each record in thedatabase.2.Data redundancy improves the integrity of a database.3.SQL is the language used by relational databases to create objects and to manipulate andretrieve data.4. A relational database management system does not include tools for backing up & restoringdatabases.5.An attribute is also known as a row in most databases.6.An association between entities is known as a relationship.7.Integrity constraints limit the number of entities that can be placed in a table or database.8.The Entity-Relationship data model is often used in the physical design phase.9.The concept “relation” in relation model is exactly the same as the concept “relationship” inER model.10.Most relationship sets in a database system involves two entity sets.11.The closure of an attribute set contains that attribute set.12.Lossless decomposition is necessary in a decomposition algorithm.13.If A →B and C →D hold, then AC →BD also holds.14.It is not necessary that a legal schedule preserves the order in which the instructions appear ineach individual transaction.15.Update operations in database must be written into log before updating database.Question 2 single-choice question (2 points for each problem, 30 points in total)1. is the only one incorrect description from the followings:A. R=(R-S)∪(R∩S)B. R-S=R-(R∩S)C. R∩S=S-(R-S)D. R∩S=S-(S-R)2. Choose the only one correct expression from the followings: _ ______.other three? They are all based on the relations R(A,B) and S(B,C).A.()S R B A ,∏B. ()S R B ∏C.()S R B R A ⨯∏., D.()()()S R R B A ∏⨯∏⋂4. In the following, assume a is an attribute of some character-string type, e.g. CHAR(10), and that it may be NULL.Q1: SELECT * FROM R WHERE a IS NULL;Q2: SELECT * FROM R WHERE a NOT LIKE '%'; A.Q1 and Q2 produce the same answer.B. The answer to Q1 is always contained in the answer to Q2.C. The answer to Q2 is always contained in the answer to Q1.D. Q1 and Q2 produce different answers.5. The Entity-Relationship data model isA. DBMS dependentB. DBMS independentC. both A and BD. neither A nor B 6. In SQL, an UPDATE statement without a WHERE clause: A. Updates every row in a table. B. Updates no rows in a table. C. Updates every column in a table. D. Results in a Cartesian product.7. If a course can be taught by many teachers, and a teacher can teach only one course, then the mapping cardinality from course to teacher isA. one-to-oneB. one-to-manyC. many-to-oneD. many-to-many8. If there is a many-to-one relationship between entity A and B, thenA. there exists a functional dependency from the primary key in B to the primary key in A, i.e., PK(B) → PK(A).B. there exists a functional dependency from the primary key in A to the primary key in B, i.e., PK(A) → PK(B).C. both A and B.D. neither A nor B9. If a functional dependency AB →R holds on relation R(A, B, C), then (A, B) is definitely a ______ of R.A. super keyB. primary keyC. candidate keyD. foreign key10. A relational schema R is in _____ if the domains of all attributes of R are atomic A. 1NF B. 3NF C. BCNF D. 4NF 11. Which one of the following statement is true?A. 3NF is more strict than BCNFB. 4NF is more strict than BCNFC. 1NF is more strict than BCNFD. BCNF is the most strict normal form12. If a transaction T i has obtain an exclusive lock on data item Q, then transition T j can ______.A. obtain an exclusive lock on data item QB. obtain a shared lock on data item QC. wait for lock granting on data item QD. read or write Q without a lock13. If both <Ti start> and <Ti commit> appear in the log after the nearest checkpoint to system crash, then transaction Ti must be ______A. undoneB. redoneC. deletedD. Neither A or B 14. ______ is the final state in a life cycle of a transaction. A. committed B. aborted C. failed D. A or B15. in 2PL protocol, at stage, A transaction may obtain locks, but may not release locks.A. Shrinking phaseB. Growing phaseC. CommittedD. AbortedA hospital has properties like ID, name, location, rank, capacity. A doctor can be described by ID, name, age, skill. A patient has properties like ID, name, age, sex, address. The above three entities must satisfy some constraints: Each doctor can be unemployed or employed by one hospital. If a doctor is employed, his salary needs to be recorded in the database. A patient can go to many hospitals.1. Draw ER diagram to illustrate the above database requirement [8 points].2. Translate your ER diagram into relational database schemas, and point out the primary keys and foreign keys. You can write your answers in the following format: “R(a1, a2, a3, a4), primary key: a1, foreign key: a4”[4 points].Question 4. (24 points) The following five tables are for a company management system: EMPLOYEE (ID, Name, Birthday, Address, Sex, Salary, Dnumber)DEPARTMENT (Dnumber, Dname, MgrID )PROJECT (Pnumber, Pname, Pcity)WORKS_ON (Pnumber, E-ID, Wdate, Hours)CHILD (E-ID, CHD-ID, CHD_name, Sex, Birthday)1. Based on the giving relations, Specify the following queries using relational algebra (3 points for each).1) List the names of all employees with birthday earlier than ‘1970-1-1’ and salary less than $5000.2) List the names of all employees who have a child.3) List the cities and the total number of projects which are located on same city.2. Specify the following operations in SQL(3 points for each).1) Define the table WORKS_ON, declare Pnumber, E-ID, Wdate as the primary key, Pnumber as the foreign key referencing the primary key of project, E-ID as the foreign key referencing the primary key of employee, and ensure that the values of Hours are non-negative with default value 8.2) For each employee working on the ‘Network’ project(Pname), increase his/her salary by 5%.3) List the names of all department managers who have no child.4) Find the names of all employees in department 5 (Dnumber) who have worked on both 'X' project and 'Y' project (Pname).5) For each project, find the project number, project name and the total hours (by all employees) spent on that project in Oct. 2009.Question 5 (10 points) Consider a relation R(A, B, C, D, E, F) with the set of Functional DependenciesF = { A →BCD, BC →DE, B →D, D →A }pute the Closures of attribute sets A+, C+, E+[3 points].2.Give one candidate key of R [2 points].3.Is F equivalent to { A →BC, BC →E, B →D, D →A } ? [2 points]4.What is the highest normal form of R? Explain your reasons [3 points].Consider the following schedule S on transitions set {T1, T2, T3, T4}, with R and W denotes read and write operation respectively.S= R1(A) R2(B)R3(A)R2(C)R4(D)W2(B)R1(B)W1(D)R3(B)W3(B)W2(C)1.List all conflict operation pairs in S [3 points].2.Swapping no-conflict operations to see whether it is a serializable schedule [3 points].3.Write all its equivalent serial schedules if S is conflict serializable? Or show why if it isnot conflict serializable [3 points].华南农业大学期末考试试卷(A 卷-Answer Sheets )2014-2015学年第1 学期 考试科目: Database system 考试类型:(闭卷) 考试时间: 120 分钟 学号 姓名 年级专业题号 一 二 三 四 五 六 总分 得分 评阅人Instructions to candidates:1. Write your name, student number and class on both the question papers and the answer papers.2. DO NOT write your answers on the question papers. Write them ALL ON THE ANSWER PAPERS.3. Write your answers in either Chinese or English.4. Hand in all papers (both the question papers and the answer papers).Question 3 (12points)题号 1234 5 6 7 8 9 10 11 12 13 14 15 得分√ × √××√×××√√√√× √题号 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 得分CCCDBABBAABCBDB得分hospital(ID)patient (ID, name, age, sex, address), primary key: ID,livein(patientID, hospitalID) primary key: (hospitalID, PatientID), foreign key hospitalID refer to hospital(ID),foreign key patientID refer to patient (ID)Question 4 [24 points]1:1)()()'1970-1-1'5000NameANDSalary Employee πσ<<Birthday2)()Name ID E IDEmployee Child π=-∞3) (Pnumber)(Project)citycount G2:1) CREATE TALBE Works_On( Pnumber int,E-ID char(15), Wdate date,Hours int default 8 CHECK (Hours >= 0), PRIMARY KEY (Pnumber, E-ID, Wdate),FOREIGN KEY (E-ID) REFERENCES Employee(ID),FOREIGN KEY (Pnumber) REFERENCES Project(Pnumber), ); 2)UPDATE Employee SET Salary=Salary *1.05 WHERE ID IN(SELECT E-ID FROM Project natural join Works_on WHERE Pname=’Network’);3)SELECT Name FROM Employee, Department WHERE ID=MrgID AND ID NOT IN(SELECT E-ID FROM Child);4)SELECT Name FROM Employee WHERE Dnumber=5 AND ID IN(SELECT E-ID FROM Project natural join Works_on WH ERE Pname=’X’) AND ID INWHERE Pname=’Y’);5)SELECT Pnumber, Pname, SUM(Hours) FROM Project NATURAL JOIN Works_OnWHERE Wdate BETWEEN ‘2009-10-1’ AND ‘2009-10-31’ GROUP BY Pnumber, Pname;Question 5 [10 points]1 A +=ABCDE, C + =C, E +=E 2. AF is a candidate key of R3. Yes F equivalent to { A → BC, BC → E, B → D, D → A }4. the highest normal form of R is 1NF. The reason lies in that (1) it is not in BCNF, for A is not a super key but A → BCD. (2) It is not in 3NF for all candidate keys are: DF, AF, BF, so that primary attributes are ABDF. To A → BC, A is not a super key and c is not included in any candidate key therefore it violate rules of 3NF. (3) all attribute are atomic.Question 6 [9 points]1. conflict operation pairs (1)W 2(B)R 1(B) (2) W 2(B)R 3(B) (3)W 2(B)W 3(B) (4) R 1(B)W 3(B) (5) R 2(B) W 3(B) (6) R 4(D) W 1(D)2. S= R 1(A) R 2(B)R 3(A)R 2(C)R 4(D)W 2(B)R 1(B)W 1(D)R 3(B)W 3(B)W 2(C)=> R 2(B)R 1(A) R 2(C) R 3(A) W 2(B) R 4(D) R 1(B)W 1(D)R 3(B) W 2(C)W 3(B) => R 2(B) R 2(C)R 1(A) W 2(B) R 3(A) R 4(D) R 1(B)W 1(D) W 2(C)R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 1(A) R 4(D) R 3(A) R 1(B) W 2(C)W 1(D) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D)R 1(A) R 1(B) R 3(A) W 2(C) W 1(D) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D) R 1(A) R 1(B) W 2(C) R 3(A) W 1(D) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D) R 1(A) W 2(C)R 1(B) W 1(D) R 3(A) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D) W 2(C)R 1(A) R 1(B) W 1(D) R 3(A) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) W 2(C)R 4(D) R 1(B) W 1(D) R 3(A) R 3(B) W 3(B) 3. it is a conflict serializable schedule. The equivalent serial schedules are: T 2, T 4, T 1, T 3 or T 4, T 2, T 1, T 3信你自己罢!只有你自己是真实的,也只有你能够创造你自己。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

华南农业大学期末考试试卷(A卷)2014-2015学年第一学期考试科目:数据库系统考试类型:闭卷考试时间:120 分钟学号姓名年级专业Question 1: true-false question (15 points) For each of the following statements, indicate whether it is TRUE or FALSE (Using √for TRUE and ×for FALSE). You will get 1 point for each correct answer, -0.5 point for each incorrect answer, and 0 point for each answer left blank. Be sure to write your answer in the answer sheet.1. A primary key is a field (or group of fields) that uniquely describes each record inthe database.2.Data redundancy improves the integrity of a database.3.SQL is the language used by relational databases to create objects and tomanipulate and retrieve data.4. A relational database management system does not include tools for backing up &restoring databases.5.An attribute is also known as a row in most databases.6.An association between entities is known as a relationship.7.Integrity constraints limit the number of entities that can be placed in a table ordatabase.8.The Entity-Relationship data model is often used in the physical design phase.9.The concept “relation” in relation model is exactly the same as the concept“relationship” in ER model.10.Most relationship sets in a database system involves two entity sets.11.The closure of an attribute set contains that attribute set.12.Lossless decomposition is necessary in a decomposition algorithm.13.If A →B and C →D hold, then AC →BD also holds.14.It is not necessary that a legal schedule preserves the order in which theinstructions appear in each individual transaction.15.Update operations in database must be written into log before updating database. Question 2 single-choice question (2 points for each problem, 30 points in total)1. is the only one incorrect description from the followings:A. R=(R-S)∪(R∩S)B. R-S=R-(R∩S)C. R∩S=S-(R-S)D. R∩S=S-(S-R)2. Choose the only one correct expression from the followings: _ ______.A. (≠ some) ≡ inB. (= all) ≡ not inC. exists r ⇔ r ≠ ØD. X-Y ≠Ø ⇔ X ⊆ Y 3. of the following four expressions of relational algebra is not equivalent to the other three? They are all based on the relations R(A,B) and S(B,C).A.()S R B A ,∏B. ()S R B ∏C.()S R B R A ⨯∏., D.()()()S R R B A ∏⨯∏⋂4. In the following, assume a is an attribute of some character-string type, e.g. CHAR(10), and that it may be NULL.Q1: SELECT * FROM R WHERE a IS NULL;Q2: SELECT * FROM R WHERE a NOT LIKE '%'; A.Q1 and Q2 produce the same answer.B. The answer to Q1 is always contained in the answer to Q2.C. The answer to Q2 is always contained in the answer to Q1.D. Q1 and Q2 produce different answers.5. The Entity-Relationship data model isA. DBMS dependentB. DBMS independentC. both A and BD. neither A nor B 6. In SQL, an UPDATE statement without a WHERE clause: A. Updates every row in a table. B. Updates no rows in a table. C. Updates every column in a table. D. Results in a Cartesian product.7. If a course can be taught by many teachers, and a teacher can teach only one course, then the mapping cardinality from course to teacher isA. one-to-oneB. one-to-manyC. many-to-oneD. many-to-many8. If there is a many-to-one relationship between entity A and B, then A. there exists a functional dependency from the primary key in B to the primary key in A, i.e., PK(B) → PK(A).B. there exists a functional dependency from the primary key in A to the primary key in B, i.e., PK(A) → PK(B).C. both A and B.D. neither A nor B9. If a functional dependency AB →R holds on relation R(A, B, C), then (A, B) is definitely a ______ of R.A. super keyB. primary keyC. candidate keyD. foreign key10. A relational schema R is in _____ if the domains of all attributes of R are atomicA. 1NFB. 3NFC. BCNFD. 4NF 11. Which one of the following statement is true?A. 3NF is more strict than BCNFB. 4NF is more strict than BCNFC. 1NF is more strict than BCNFD. BCNF is the most strict normal form 12. If a transaction T i has obtain an exclusive lock on data item Q, then transition T j can ______.A. obtain an exclusive lock on data item QB. obtain a shared lock on data item QC. wait for lock granting on data item QD. read or write Q without a lock13. If both <Ti start> and <Ti commit> appear in the log after the nearest checkpoint to system crash, then transaction Ti must be ______ A. undone B. redone C. deleted D. Neither A or B14. ______ is the final state in a life cycle of a transaction.A. committedB. abortedC. failedD. A or B15. in 2PL protocol, at stage, A transaction may obtain locks, but may not release locks.A. Shrinking phaseB. Growing phaseC. CommittedD. Aborted Question 3 (12 points) Consider the following database requirement:A hospital has properties like ID, name, location, rank, capacity. A doctor can be described by ID, name, age, skill. A patient has properties like ID, name, age, sex, address. The above three entities must satisfy some constraints: Each doctor can be unemployed or employed by one hospital. If a doctor is employed, his salary needs to be recorded in the database. A patient can go to many hospitals.1. Draw ER diagram to illustrate the above database requirement [8 points].2. Translate your ER diagram into relational database schemas, and point out the primary keys and foreign keys. You can write your answers in the following format: “R(a1, a2, a3, a4), primary key: a1, foreign key: a4”[4 points].Question 4. (24 points) The following five tables are for a company management system:EMPLOYEE (ID, Name, Birthday, Address, Sex, Salary, Dnumber) DEPARTMENT (Dnumber, Dname, MgrID )PROJECT (Pnumber, Pname, Pcity)WORKS_ON (Pnumber, E-ID, Wdate, Hours)CHILD (E-ID, CHD-ID, CHD_name, Sex, Birthday)1. Based on the giving relations, Specify the following queries using relational algebra (3 points for each).1) List the names of all employees with birthday earlier than ‘1970-1-1’ and salary less than $5000.2) List the names of all employees who have a child.3) List the cities and the total number of projects which are located on same city. 2. Specify the following operations in SQL(3 points for each).1) Define the table WORKS_ON, declare Pnumber, E-ID, Wdate as the primary key, Pnumber as the foreign key referencing the primary key of project, E-ID as the foreign key referencing the primary key of employee, and ensure that the values of Hours are non-negative with default value 8.2) For each employee working on the ‘Network’ project(Pname), increase his/her salary by 5%.3) List the names of all department managers who have no child.4) Find the names of all employees in department 5 (Dnumber) who have worked on both 'X' project and 'Y' project (Pname).5) For each project, find the project number, project name and the total hours (by all employees) spent on that project in Oct. 2009.Question 5 (10 points) Consider a relation R(A, B, C, D, E, F) with the set of Functional DependenciesF = { A →BCD, BC →DE, B →D, D →A }pute the Closures of attribute sets A+, C+, E+[3 points].2.Give one candidate key of R [2 points].3.Is F equivalent to { A →BC, BC →E, B →D, D →A } ? [2 points]4.What is the highest normal form of R? Explain your reasons [3 points]. Question 6 (9 points) There are 3 transactions:Consider the following schedule S on transitions set {T1, T2, T3, T4}, with R and W denotes read and write operation respectively.S= R1(A) R2(B)R3(A)R2(C)R4(D)W2(B)R1(B)W1(D)R3(B)W3(B)W2(C)1.List all conflict operation pairs in S [3 points].2.Swapping no-conflict operations to see whether it is a serializable schedule [3points].3.Write all its equivalent serial schedules if S is conflict serializable? Or showwhy if it is not conflict serializable [3 points].华南农业大学期末考试试卷(A 卷-Answer Sheets )2014-2015学年第1 学期 考试科目: Database system 考试类型:(闭卷) 考试时间: 120 分钟 学号 姓名 年级专业Instructions to candidates:1. Write your name, student number and class on both the question papers and the answer papers.2. DO NOT write your answers on the question papers. Write them ALL ON THE ANSWER PAPERS.3. Write your answers in either Chinese or English.4. Hand in all papers (both the question papers and the answer papers).Question 3 (12points)hospital(ID, name, location, rank, capacity), primary key: ID,doctor(ID, name, age, skill, hospitalID, salary), primary key: ID, foreign key: hospitalID refer to hospital(ID)patient (ID, name, age, sex, address), primary key: ID,livein(patientID, hospitalID) primary key: (hospitalID, PatientID), foreign key hospitalID refer to hospital(ID), foreign key patientID refer to patient (ID)Question 4 [24 points]1:1)()()'1970-1-1'5000NameANDSalary Employee πσ<<Birthday2)()Name ID E IDEmployee Child π=-∞3) (Pnumber)(Project)citycount G2:1) CREATE TALBE Works_On( Pnumber int,E-ID char(15), Wdate date,Hours int default 8 CHECK (Hours >= 0), PRIMARY KEY (Pnumber, E-ID, Wdate),FOREIGN KEY (E-ID) REFERENCES Employee(ID),FOREIGN KEY (Pnumber) REFERENCES Project(Pnumber), ); 2)UPDA TE Employee SET Salary=Salary *1.05 WHERE ID IN(SELECT E-ID FROM Project natural join Works_on WHERE Pname=’Network’);3)SELECT Name FROM Employee, Department WHERE ID=MrgID AND ID NOT IN(SELECT E-ID FROM Child);4)SELECT Name FROM EmployeeWHERE Dnumber=5 AND ID IN(SELECT E-ID FROM Project natural join Works_on WHERE P name=’X’) AND ID IN(SELECT E-ID FROM Project natural join Works_on WHERE Pname=’Y’); 5)SELECT Pnumber, Pname, SUM(Hours) FROM Project NATURAL JOIN Works_OnWHERE Wdate BETWEEN ‘2009-10-1’ AND ‘2009-10-31’ GROUP BY Pnumber, Pname;Question 5 [10 points]1 A +=ABCDE, C + =C, E +=E 2. AF is a candidate key of R3. Yes F equivalent to { A → BC, BC → E, B → D, D → A }4. the highest normal form of R is 1NF. The reason lies in that (1) it is not in BCNF, for A is not a super key but A → BCD. (2) It is not in 3NF for all candidate keys are: DF, AF, BF, so that primary attributes are ABDF. To A → BC, A is not a super key and c is not included in any candidate key therefore it violate rules of 3NF. (3) all attribute are atomic.Question 6 [9 points]1. conflict operation pairs (1)W 2(B)R 1(B) (2) W 2(B)R 3(B) (3)W 2(B)W 3(B) (4) R 1(B)W 3(B) (5) R 2(B) W 3(B) (6) R 4(D) W 1(D)2. S= R 1(A) R 2(B)R 3(A)R 2(C)R 4(D)W 2(B)R 1(B)W 1(D)R 3(B)W 3(B)W 2(C)=> R 2(B)R 1(A) R 2(C) R 3(A) W 2(B) R 4(D) R 1(B)W 1(D)R 3(B) W 2(C)W 3(B) => R 2(B) R 2(C)R 1(A) W 2(B) R 3(A) R 4(D) R 1(B)W 1(D) W 2(C)R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 1(A) R 4(D) R 3(A) R 1(B) W 2(C)W 1(D) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D)R 1(A) R 1(B) R 3(A) W 2(C) W 1(D) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D) R 1(A) R 1(B) W 2(C) R 3(A) W 1(D) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D) R 1(A) W 2(C)R 1(B) W 1(D) R 3(A) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) R 4(D) W 2(C)R 1(A) R 1(B) W 1(D) R 3(A) R 3(B) W 3(B) => R 2(B) R 2(C) W 2(B) W 2(C)R 4(D) R 1(B) W 1(D) R 3(A) R 3(B) W 3(B) 3. it is a conflict serializable schedule. The equivalent serial schedules are: T 2, T 4, T 1, T 3 or T 4, T 2, T 1, T 3。

相关文档
最新文档