数据库考试题及答案.doc

上传人:仙人指路1688 文档编号:4109537 上传时间:2023-04-04 格式:DOC 页数:31 大小:102KB
返回 下载 相关 举报
数据库考试题及答案.doc_第1页
第1页 / 共31页
数据库考试题及答案.doc_第2页
第2页 / 共31页
数据库考试题及答案.doc_第3页
第3页 / 共31页
数据库考试题及答案.doc_第4页
第4页 / 共31页
数据库考试题及答案.doc_第5页
第5页 / 共31页
点击查看更多>>
资源描述

《数据库考试题及答案.doc》由会员分享,可在线阅读,更多相关《数据库考试题及答案.doc(31页珍藏版)》请在三一办公上搜索。

1、习题 一、 12分 用英文解释1、 DBMS 2、Data Dictionary 3、Transaction10分 单项选择题1There may be instances where an attribute has a set of values for a specific entity. This type of attribute is said to be 【】Asingle valued attribute Bmultivalued attributesimple attribute Dcomposite attribute2In a particular bank, a loa

2、n can belong to only one customer, and a customer can have several loans, then the relationship set from customer to loan is【】Aone to many Bmany to many Cmany to one Done to one3A【】contains metadata that is, data about data.Atable Bview Cdata dictionary Dtrigger4The phrase greater than at least one

3、is represented in SQL by【】A>all B<all C<some D>some5In general, all aggregate functions except 【】ignore null values in their input collection.Asum Bavg Cmin Dcount6If a schedule S can be transformed into a schedule S by a series of swaps of non-conflicting instructions, we say that S and

4、 S are【】Anon-conflicting equivalent Bconflict equivalentCnon-conflicting serializable Dconflict serializable7The fundamental operations in the relational algebra are【】。A,-,和 B,-,和C,和 D,和8In SQL, =some is identical to in, and【】is identical to not in。A<>some B=all C<>all D=some9The result

5、of true and null is【】。Anull Btrue Cfalse Dnot null10The function sum applied on the collection 1,1,3,4,4,11 returns the value【】.A24 B6 C4 D11三、10分 设有Course(课程)、Teacher(教师)、Student(研究生),其中:l Course有属性cno(课程号)、cname(课程名)和mark(学分);1lll Teacher有属性tno(教师编号)、tname(教师姓名)和major(专业属性); Student有属性sno(学号)、snam

6、e(学生姓名)、age(年龄)、 bno(班级号)、score(总成绩)属性。 Teacher与Student之间有指导论文的联系,用Supervise表示,每位教师可指导多名研究生,每名研究生有且只能有一位指导教师;Teacher与Course之间有讲授的联系,用Teach表示,每位教师可以教授多门课程,每门课程可同时由多位教师开设。 l试画出E-R图。四、12分 题设与第三题相同,试根据你所画的E-R图,设计出关系数据库,并指出每个关系中的主键和外键。五、8分 题设与第三题相同,试用关系代数表达:1检索编号为t01的老师的姓名2检索班级号为b01或者年龄大于21岁所有学生的姓名六、12分题

7、设与第三题相同。使用SQL表达:1建立表结构Course(课程)、Teacher(教师)、Student(研究生)(其中要求age大于零;定义必要的主键和外键)。2将学号为a01,姓名为zhang,年龄为22的学生信息加入到Student表中3检索专业为计算机的老师的姓名和编号, 并按编号由大到小排列 。4将学号以a01开头的学生信息删除。5检索比b01班所有学生的总成绩都高的学生的姓名,去掉重复的姓名。6检索张山老师所教的学生的平均总成绩(假设不存在教师重名现象)。七、12分 设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F= BCAD,ADEB,EC 。1.

8、R是否属于3NF?为什么?2. R是否属于BCNF?为什么?八、12分设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F包含如下函数依赖F=ABC, DA, EC, BCD, BA1、求X=BD关于F的闭包X+.2、求F的一个正则覆盖.3、求满足3NF分解的关系模式九、12分 设有如下调度S。2 1. 判别S是否为冲突可串行化调度?2. 如果是冲突可串行化调度,则给出与S冲突等价的串行调度。习题答案 八、12分 用英文解释(每题3分)2、 DBMS: A database management system consists of a collection of i

9、nterrelated data and acollection of programs to access those data.3、 Data dictionary: A data dictionary is a file that contains metadata, that is data about data.4、 Transaction: The transaction is a unit of program execution that accesses and possibly updatesvarious data items.九、10分 单项选择题 (每题1分)1【B】

10、2【A】3【C】 4【D】5【D】6【B】7【A】8【C】9【A】10【A】十、 10分E-R (1) 正确描述出Teacher、Course、Teach、Supervise、Student五个实体集及联系集及其相关属性5分(2) 描述出Teacher和Student之间为1对多关系 -1分(3) 描述出Teacher和Course之间为多对多关系 -1分(4) 矩形、菱形等符号表示正确 -3分十一、 12分Course(cno, cname, mark) 主键:cno 2分Teacher (tno, tname, major) 主键:tno 2分Student (sno, sname, ag

11、e, bno, tno,score) 主键:sno 外键:tno-4分 其中主键和外键各占1分Teach(tno, cno) 主键:tno, cno 外键:tno和cno4分 其中主键和外键各占1.5分十二、 8分tname(stno=t01(Teacher) 4分 sname(sage>21 or sbno=b01(Student) -4分十三、 12分1create table Course (cno char(4),cname char(10),mark integer,primary key(cno) -1分 create table Teacher (tno char(10),

12、tname char(4),major char(8)primary key(tno) 1分 create table Student (sno char(10),sname char(10),age integer,tno char(10),bno char(10),4score integer,primary key(sno),foreign key(tno) references Teacher (tno),check (age>0) -1分 create table Teach(tno char(10),cno char(4),primary key(tno,cno),forei

13、gn key(tno) references Teacher (tno),foreign key(cno) references Course (cno) 1分 2insert into Student(sno,sname,age) values (a01, zhang, 22)2分3Select tname, tnofrom Teacherwhere major=计算机order by tno desc -1.5分 order by语句正确占0.5分 4Delete from StudentWhere sno like a01%-1.5分 like语句表达正确占0.5分5select dis

14、tinct snamefrom Studentwhere score>(select max(score)from studentwhere bno=b01) -1.5分6 Select avg(score)From studentwhere tno=(Select tnoFrom TeacherWhere tname=张山) -1.5分十四、 12分BC, AD, BE都是候选码,-4分1所有属性都是某个候选码的属性,显然是3NF。-4分2E>C非平凡依赖, 而E不是R的一个超码,R不属于BCNF -4分 十五、 12分1X+=ABDC 1.5分2正则覆盖:DA EC BCD-4

15、.5分 每个依赖1.5分3D,AE,CB,C,D B,E-6分 每个模式1.5分5 十六、 12分1. S 为冲突可串行化调度。-4分2. 冲突等价的串行调度为<T2, T3, T1> -8分 十七、 12分 用英文解释:6、 Transaction7、 DBMS8、 Data model十八、 20分 选择题:1. 一个关系中的主键()。A. 不可能多于一个 B. 不可以作为其他关系的外部键C. 可以取空值 D. 不可以是属性组合2. 在数据库中,产生数据不一致的根本原因是()。A. 数据存储量太大B. 数据冗余C. 未对数据进行完整性控制D. 没有严格保护数据3. 事务在执行时

16、,所遵循的要么所有操作全部发生,要么由于出错而全不发生这是事务的()性质.A. 隔离性 B. 持久性C. 原子性 D. 一致性4. ()是数据抽象的最低层次,描述数据实际上是怎样存储的。A. 物理层 B. 逻辑层C. 视图层 D. 子模式层5. 对数据库系统进行集中控制的人称为()。A. 操作系统管理员 B. 数据库管理员C. 数据库操作员 D. 程序员6. 中的一个实体至多同中的一个实体相联系,而中的一个实体可以同中任意数目的实体相联系,则和之间的映射基数为()。A. 一对多 B. 一对一C. 多对一 D. 多对多7. ()提供定义关系模式、删除关系以及修改关系模式的命令。A. 数据定义语言

17、 B. 视图定义语言C. 数据操纵语言 D. 动态SQL语言8. 事务不具有的性质有()。A. 原子性 B. 可恢复性C. 隔离性 D. 持久性9. 计算过程中不忽略Null值的聚集函数包括()。A. avg ( ) B. max ( )6C. min ( ) D. count ( )10. 假设关系person包含元组John, Smith, Jeffrey, Mary, Valeria,关系customer包含元组John, Jeffrey, Tom。则person和customer的集合差运算结果应该包含()个元组。A. 3 B. 2 C. 1 D. 5三、8分 请设计一个体育比赛技术统

18、计数据库。数据库对每个运动员保存个人记录,包括:姓名、性别、年龄、身份证号。对每项比赛存有:比赛编号、比赛时间、地点、比分、参加比赛的球队名称。还应记录上场队员在每场比赛的统计数据,包括:进球数、助攻次数。画出相应的E-R图,并加以必要的说明。四、8分 根据下面的E-R图设计关系数据库,要求指出相应的主键和外键。 五、12分 考虑下图所示员工数据库。为下面每个查询语句写出SQL表达式。. 找出不为First Bank Corporation工作的所有员工的名字. 修改数据库,使得Jones现在居住在Newtown市找出各个公司员工的平均工资,并按照公司名称排序(逆序)。d 删除works关系中

19、的所有元组。六、10分 关于关系模式R=(A, B, C, D, E) 的函数依赖集F如下所示,ABCCDEBDEA. 计算正则覆盖FC. 计算闭包(AB)+ 七、10分 设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F= ABC,CDE,BD,EA 。 下面是R的两个分解(1) R1=( A, B, C )和R2(A, D, E )7(2) R1=( A, B, C )和R2 ( C, D, E )试判别,是否为无损连接分解,为什么?八、10分 设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F= ABC, CDE, BD, AD 。

20、求满足3NF分解的关系模式。九、10分 考虑如下所示的优先图,相应的调度是冲突可串行化的吗?如果是,请给出串行化调度次序。参考答案 十九、 12分 用英文解释:9、 Transaction:A transaction is a unit of program execution that accesses and possibly updates various dataitems.10、 DBMS:A database management system consists of a collection of interrelated data and a collection ofprog

21、rams to access that data.11、Data model:A collection of conceptual tools for describing data, data relationships, data semantics, anddata constraints.二十、 20分 选择题:A. B.C.A.B.C.A.B.D.A三、8分 请设计一个体育比赛技术统计数据库。数据库对每个运动员保存个人记录,包括:姓名、性别、年龄、身份证号。对每项比赛存有:比赛编号、比赛时间、地点、比分、参加比赛的球队名称。还应记录上场队员在每场比赛的统计数据,包括:进球数、助攻次数

22、。画出相应的E-R图,并加以必要的说明。 四、8分 根据下面的E-R图设计关系数据库,要求指出相应的主键和外键。8 account (account_number, balance, branch_name) primary key (account_number) foreign key (branch_name)branch (branch_name, branch_city, assets) primary key (branch_name) customer (customer_name, customer_city) primary key (customer_name) depos

23、itor (account_number, customer_name)primary key (account_number, customer_name)foreign key (account_number)foreign key (customer_name)五、12分 考虑下图所示员工数据库。为下面每个查询语句写出SQL表达式。. 找出不为First Bank Corporation工作的所有员工的名字select employee-namefrom workswhere company-name != First Bank Corporation. 修改数据库,使得Jones现在居

24、住在Newtown市update employeeset city= Newtownwhere employee-name= Jones找出各个公司员工的平均工资,并按照公司名称排序(逆序)。Select company-name, avg (salary)From worksGroup by company-nameOrder by company-name descd 删除works关系中的所有元组。Delete from works六、10分 关于关系模式R=(A, B, C, D, E) 的函数依赖集F如下所示, ABCCDEBDEA9. 计算正则覆盖FC. 计算闭包(AB)+答:FC

25、= ABC,CDE,BD,EA (AB)+=ABCDE七、10分 设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F= ABC,CDE,BD,EA 。 下面是R的两个分解(1) R1=( A, B, C )和R2(A, D, E )(2) R1=( A, B, C )和R2 ( C, D, E )试判别,是否为无损连接分解,为什么?答:是无损连接分解, 不是无损连接分解 八、10分 设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F= ABC, CDE, BD, AD 。求满足3NF分解的关系模式。答:R1=ABC, R2=CDE, R3

26、=BD 九、10分 考虑如下所示的优先图,相应的调度是冲突可串行化的吗?如果是,请给出串行化调度次序。T1,T2,T6,T3,T4,T5习题6 二十一、 12分 用英文解释:12、 View13、 DBMS14、 Query Language二十二、 10分 填空题(在下列各小题中的括号部分省略了数据库系统的术语,在答题纸上写好小题号,并在其后用英文填写相应的术语):1. The collection of information stored in the database at a particular moment is called an ( ) of thedatabase.2. A

27、 ( ) is a language that enables users to access or manipulate data as organized by theappropriate data model.3. A person who has such central control over the system is called a ( ).4. Application programs are said to exhibit ( ) if they do not depend on the physical schema, 10and thus need not be r

28、ewritten if the physical schema changes.5. A ( ) is a collection of conceptual tools for describing data, data relationships, data semantics,and consistency constraints.6. The overall design of the database is called the ( ).7. An ( ) is a set of the same type that share the same properties, or attr

29、ibutes.8. We choose a minimal superkey for each entity set from among its superkeys; the minimal superkey is termed theentity sets ( ).9. Any relation that is not part of the logical model, but is made visible to a user as a virtual relation, is called a( ).10. SQL allows the use of ( ) values to in

30、dicate absence of information about the value of an attribute.三、8分 请设计一个图书馆数据库,此数据库中对每个借阅者保存读者记录,包括:读者号、姓名、地址、性别、年龄、单位。对每本书存有:书号、书名、作者、出版社。同一书名的书有多本,以便被多个读者借阅。对每本被借出的书应记录借出日期和应还日期。画出相应的E-R图,并加以必要的说明。四、8分 根据下面的E-R图设计关系数据库,要求指出相应的主键和外键。 五、12分 考虑下图所示员工数据库。为下面每个查询语句写出SQL表达式。. 找出所有为First Bank Corporation

31、工作的员工的名字. 修改数据库,使得Jones现在居住在Newtown市找出各个公司员工的平均工资,并按照公司名称排序(逆序)。d 为First Bank Corporation所有员工增加10%的薪水。六、10分 设有关系模式R=(A, B, C, D, E),R上的函数依赖集F = AB,CDE,AC。给出R的一个无损连接的BCNF分解。七、 10分 设有关系模式R=(A, B, C, D, E),R上的函数依赖集F = ABC, CDE,BD,EA 。计算(AB)+?八、10分 设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F = ABC, CDE, AD。

32、求满足3NF分解的关系模式。11九、10分 如下所示的调度是冲突可串行化的吗?如果是,请给出串行化调度次序。 参考答案 二十三、 12分 用英文解释:15、 View views are virtual relations defined by a query language16、 DBMS A database management system consists of a collection of interrelated data and a collection ofprograms to access that data.17、 Query Language A query la

33、nguage in which a user requests information from the database.二十四、 10分 填空题(在下列各小题中的括号部分省略了数据库系统的术语,在答题纸上写好小题号,并在其后用英文填写相应的术语):1. The collection of information stored in the database at a particular moment is called an ( instance ) of the database.2. A ( DML ) is a language that enables users to acce

34、ss or manipulate data as organized by the appropriate data model.3. A person who has such central control over the system is called a ( DBA ).4. Application programs are said to exhibit (physical data independence ) if they do not depend on the physicalschema, and thus need not be rewritten if the p

35、hysical schema changes.5. A (Data Model) is a collection of conceptual tools for describing data, data relationships, data semantics, andconsistency constraints.6. The overall design of the database is called the (database schema ).7. An (entity ) is a set of the same type that share the same proper

36、ties, or attributes.8. We choose a minimal superkey for each entity set from among its superkeys; the minimal superkey is termed theentity sets ( candidate key ).9. Any relation that is not part of the logical model, but is made visible to a user as a virtual relation, is called a (view ).10. SQL al

37、lows the use of (null) values to indicate absence of information about the value of an attribute.三、8分 请设计一个图书馆数据库,此数据库中对每个借阅者保存读者记录,包括:读者号、姓名、地址、性别、年龄、单位。对每本书存有:书号、书名、作者、出版社。对每本被借出的书应记录借出日期和应还日期。画出相应的E-R图,并加以必要的说明。12 四、8分 根据下面的E-R图设计关系数据库,要求指出相应的主键和外键。 account (account_number, balance, branch_name)

38、primary key (account_number) foreign key (branch_name)branch (branch_name, branch_city, assets) primary key (branch_name) customer (customer_name, customer_city) primary key (customer_name) depositor (account_number, customer_name)primary key (account_number, customer_name)foreign key (account_numbe

39、r)foreign key (customer_name)五、12分 考虑下图所示员工数据库。为下面每个查询语句写出SQL表达式。. 找出所有为First Bank Corporation工作的员工的名字select employee-namefrom workswhere company-name= First Bank Corporation. 修改数据库,使得Jones现在居住在Newtown市update employeeset city= Newtownwhere employee-name= Jones 13找出各个公司员工的平均工资,并按照公司名称排序(逆序)。Select co

40、mpany-name, avg (salary)From worksGroup by company-nameOrder by company-name desc d 为First Bank Corporation所有员工增加10%的薪水。Update worksSet salary=salary*1.1where company-name= First Bank Corporation六、10分 设有关系模式R=(A, B, C, D, E),R上的函数依赖集F = AB,CDE,AC。给出R的一个无损连接的BCNF分解。R1=ABR2=CDER3=ACR4=AD七、 10分 设有关系模式R

41、=(A, B, C, D, E),R上的函数依赖集F = ABC, CDE,BD,EA 。计算(AB)+?(AB)+=ABCDE八、10分 设有属于1NF的关系模式R=(A, B, C, D, E),R上的函数依赖集F = ABC, CDE, AD。求满足3NF分解的关系模式。R1=ABCR2=CDE九、10分 如下所示的调度是冲突可串行化的吗?如果是,请给出串行化调度次序。 1. 是2. T1,T2 习题1 二十五、 12分 用英文解释:18、 Query Language1419、 First normal form (1NF)20、 View二十六、 10分 填空题(在下列各小题中的括号

42、部分省略了数据库系统的术语,在答题纸上写好小题号,并在其后用英文填写相应的术语):1. An ( ) is an object that exists in the real world and is distinguishable from other objects.2. The overall design of the database is called the ( ).3. We say that a schedule S is ( ), if it is conflict equivalent to a serial schedule.4. A ( ) is an associa

43、tion among several entities.5. Let R be a relation schema. A subset K of R is a ( ) of R if, in any legal relation r(R), for all pairs t1 and t2 of tuples in r such that t1 t2, then t1K t2K.6. Underlying the structure of a database is the ( ): a collection of conceptual tools for describing data, data relationships, data semantics, and data constraints.7. A ( ) is a language that enables users to access or manipulate data.8. A database schema is specified by a set of definitions that are expressed using a ( ).9. A ( ) is a unit of program

展开阅读全文
相关资源
猜你喜欢
相关搜索

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


备案号:宁ICP备20000045号-2

经营许可证:宁B2-20210002

宁公网安备 64010402000987号