04735《数据库系统原理》复习题答案
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
04735《数据库系统原理》复习题答案
数据库系统原理(课程代码04735)
一、单项选择题(本大题共24小题)在每小题列出的四个备选项中只有一个是最符合题目要求的,请将其代码填写在题后的括号内。
错选、多选或未选均无分。
1.DBS具有较高的数据独立性,是因为DBS采用了【 B 】A.嵌入式语言B.三级模式结构
C.DD D.六个层次的存储介质
2.在层次、网状模型中,起导航数据作用的是【A 】A.指针B.关键码
C.DD D.索引
3.设关系R(A,B,C)和关系S(B,C,D), 那么与R?S等价的关系代数表达式是【B 】A.σ2=4(R?S)B.σ2=4(R×S)
C.σ2=1(R?S)D.σ2=1(R×S)
4.设关系R和S的结构相同,分别有m和n个元组,那么R-S 操作的结果中元组个数为【 C 】A.为m-n B.为m
C.小于等于m D.小于等于(m-n)
5. 设有两个事务T1、T2,A、B的初始值分别为10和5,其并发操作如图1所示,下面评价正确的是【C 】A.该调度(schedule)不存在并发问题B.该调度是可串行化的(serializable)。
C.该调度存在冲突(conflict)操作D.该调度不存在冲突操作
T1 T2
read(A)
read(B)
sum=A+B
read(A)
A=A*2
write(A)
read(A)
read(B)
sum=A+B
write(A+B)
图1 事务并发操作图
6.设有关系R(A,B,C)的值如下:
bvi ousl y, face Chi na's S ociali st system, the Communist Party is not the party. In that case, political cha os has bee n very tight. Is remodeling or reconstructi on, i s a correcti on or a st ove. Whether to tur n right or left, is back t o the sour ce or put forward new political idea s. This is to determ ine the r oad problems i n China, i s also the key out of the deep water of the reform of t he economic sy stem. After 18, the new Ce ntral collective leader shi p attache s great importance to political orie ntation. First, the "Central eig ht articles" a s a starting poi nt, starting from t he Ce ntral Governme nt's self-restraint, w hich pre aches a nd pro-image, brought fresh feeling to the community. Secondl y, before reform a nd openi ng up and reform and openi ng two peri ods after non-negative, untying the tangle of the soci ety a long time on this i ssue. T hird, a new ge neration of party leaders on vari ous oc casi ons to Ma o Ze-Dong and Ma o Ze-Dong's
thoug ht of evaluati on has room for manoeuvre, t hrough to t he ruli ng ideol ogy of Ma o Zedong thoug ht, is the call of the soul t o the S ociali st Revoluti on a nd construction. Empty talks je opar dize national interest s and try again, i s an affirmation of Deng Xia o-ping's reform i deas. These strong political signa l showi ng a ne w generati on of politi cal leaders is st ill keepi ng to the Socialist roa d. Four is revisiti ng the "talking t o Mao Z e-Dong's hist orical cycle of" high pr ofile anti-corruption and the im portance of the Constit ution, reorga nization is bad style of
officialdom, was t o civil ize people obey t he law, while improvi ng the col or change of the regime of vigilance. Five is to reform into dee per waters a nd stre sse d that top-leve l desig n, thi s is a revi ew on the reform a nd ope ning up i n the past, i s also looking for a way out. Six foreign and Russia cl oser, the flexible attitude on the issue of t he Korean peni nsula, Si no-Japane se fishing
hardli ne China on the island out of the "patie nt" and low profile sha dow began to gradually pl an development. Signs show that the new lea dership began to make a left turn i n politics. However, as of right now, not only i deological confusi on i n the communit y, the new lea dership's t hinki ng is messy. New lea ders both stressed t he nee d to impleme nt the Constitution, stressed the nee d to tur n off the power in a cage. Also stresse s that Ma o Zedong thought cannot be l ost, 30 year s after the reform and ope ning up 30 years ag o ca n not deny ea ch other. Both adv ocate democra cy and rele ase "seven does not speak of" files of political constraints. Neither deny t he hist ory of the CPC Central Committee on several i ssues ...
A B C
5 6 5
6 7 5
6 8 6
下列叙述正确的是【B 】A.函数依赖C→A在上述关系中成立B.函数依赖AB→C在上述关系中成立C.函数依赖A→C在上述关系中成立D.函数依赖C→AB在上述关系中成立7.设关系模式R(A,B,C,D),F是R上成立的FD集,F={ A→C,BC→D },那么ρ={ ABD,AC }相对于F 【 B 】
A.是无损联接分解,也是保持FD的分解
B.是无损联接分解,但不保持FD的分解
C.不是无损联接分解,但保持FD的分解
D.既不是无损联接分解,也不保持FD的分解
8.概念设计的结果得到的是概念模式。
概念模式是【 D 】A.与DBMS有关的B.与硬件有关的
C.独立于DBMS的D.独立于DBMS和硬件的
9.在有关“弱实体”的叙述中,不正确的是【 C 】A.弱实体的存在以父实体的存在为前提
B.弱实体依赖于父实体的存在
C.父实体与弱实体的联系可以是1:1、1:N或M:N
D.父实体与弱实体的联系只能是1:1或1:N
10.有15个实体类型,并且它们之间存在着15个不同的二元联系,其中5个是1:1联系类型,5个是1:N联系类型,5个M:N联系类型,那么根据转换规则,这个ER 结构转换成的关系模式有【 B 】A.15个B.20个C.25个D.30个
11.关系运算中花费时间可能最长的运算是【C 】A.投影B.选择C.笛卡尔积D.除
12.关系规范化中的插入操作异常是指【D 】A.不该删除的数据被删除B.不该插入的数据被插入
C.应该删除的数据未被删除D.应该插入的数据未被插入
13.数据库在磁盘上的基本组织形式是【B 】A.DB B.文件 C.二维表 D.系统目录
14.在DBS中,最接近于物理存储设备一级的结构,称为【 D 】A.外模式B.概念模式C.用户模式D.内模式
15.从模块结构考察,DBMS由两大部分组成:【B 】A.查询处理器和文件管理器B.查询处理器和存储管理器
C.数据库编译器和存储管理器D.数据库编译器和缓冲区管理器State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat 16.设W=R?S,且W、R、S的属性个数分别为w、r和s,那么三者之间应满
足【 A 】
A.w≤r+s B.w<r+s C.w≥r+s D.w>r+s
17.设有关系R(A,B,C)和关系S(B,C,D),那么与R?S等价的关系代数表达式是【C 】A.π1,2,3,4(σ2=1∧3=2(R×S))B.π1,2,3,6(σ2=1∧3=2(R×S))
C.π1,2,3,6(σ2=4∧3=5(R×S))D.π1,2,3,4(σ2=4∧3=5(R×S))18.在关系模式R中,函数依赖X→Y的语义是【B 】A.在R的某一关系中,若两个元组的X值相等,则Y值也相等
B.在R的每一关系中,若两个元组的X值相等,则Y值也相等C.在R的某一关系中,Y值应与X值相等
D.在R的每一关系中,Y值应与X值相等
19.设有关系模式R(A,B,C,D),R上成立的FD集F={A→C,B→C},则属性集BD 的闭包(BD)+为【 B 】
A.BD B.BCD C.ABD D.ABCD
20.有10个实体类型,并且它们之间存在着10个不同的二元联系,其中2个是1:1联系类型,3个是1:N联系类型,5个是M:N联系类型,那么根据转换规则,这个ER结构转换成的关系模式有【 B 】
A.13个B.15个 C.18个 D.20个
21.关系模式R分解成数据库模式ρ的一个优点是【 D 】
A.数据分散存储在多个关系中B.数据容易恢复
C.提高了查询速度D.存储悬挂元组
22.事务并发执行时,每个事务不必关心其他事务,如同在单用户环境下执行一样,这个性质称为事务的【 D 】
A.持久性B.一致性 C.孤立性 D.隔离性
23.用户或应用程序使用数据库的方式称为【 B 】A.封锁B.权限 C.口令D.事务
24.常用的关系运算是关系代数和。
【 C 】
A .集合代数
B .逻辑演算
C .关系演算
D .集合演算
二、填空题(本大题共10小题)
请在每小题的空格中填上正确答案。
错填、不填均无分。
25. 概念模型是按__用户的观点对数据建模,强调其语义表达能力。
26. 层次模型和网状模型的数据结构分别是树和__有向图。
27.最常用的数据库的恢复技术是__数据转储和登录日志文件。
bvi ousl y, face China's Socialist system, the Communist Party is not the party. In that ca se, political chaos has been very tight. Is remodeling or reconstr uction, is a corre ction or a stove. Whether to t urn right or left, is back t o the source or put forward new political i deas. This is to determine the road probl ems in China, is also the key out of the deep water of the reform of the economic system. After 18, the new Ce ntral coll ective lea dership attaches great importa nce t o political or ientation. First, the "Central eight articles" as a starting poi nt, starting from the Central Gov ernment's self-restraint, w hich prea ches a nd pro-image, br ought fresh feeling to the community. Secondl y, before reform and openi ng up and reform and ope ning tw o peri ods after non-negative, untyi ng the tangle of the society a long time on this issue. Third, a new ge neration of party lea ders on various occasions to Ma o Ze-Dong a nd M ao Ze-Dong's
thoug ht of evaluation ha s room for manoeuvre, through to the ruling i de ology of Ma o Zedong thought, i s the call of the soul to t he Socialist Revol ution a nd construction. Empty talks je opardi ze nati onal i nterests and try again, is a n affirmation of De ng Xia o-ping's reform ideas. These strong political signal showing a new generation of politi cal leader s is still kee ping to t he Socialist roa d. Four is revisiting the "talking to Mao Ze-
Dong's histori cal cy cle of" high profile anti-corruption and t he importance of the Constit ution, reorganization is ba d style of official dom, was t o civilize pe ople obey the law, w hile impr oving the col or change of the regime of vigilance. Five is to reform into deeper waters a nd stresse d that top-level design, this i s a review on the reform and openi ng up i n the past, is also looking for a way out. Six foreign and Russia cl oser, the flexible attit ude on the i ssue of the Korean peni nsula, Sino-Ja pane se fishi ng
hardli ne China on the island out of the "patie nt" and low profile sha dow began to gradually pl an development. Signs show that the new lea dership began to make a left turn i n politics. However, as of right now, not only i deological confusi on i n the communit y, the new lea dership's t hinki ng is messy. New lea ders both stressed t he nee d to impleme nt the Constitution, stressed the nee d to tur n off the power in a cage. Also stresse s that Ma o Zedong thought cannot be l ost, 30 year s after the reform and ope ning up 30 years ag o ca n not deny ea ch other. Both adv ocate democra cy and rele ase "seven does not speak of" files of political constraints. Neither deny t he hist ory of the CPC Central Committee on several i ssues ...
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat 28.关系模型通常由:数据结构、数据操纵和__完整性约束三部分组成
29.在关系代数中,五个基本操作的运算符的中文名称是并、差、笛卡儿积、选择和投影。
30. DBA有两个很重要的工具:_数据字典和实用程序。
31.函数依赖X→Y能从推理规则推出的充分必要条件是Y?X+。
32. 关系中主码的取值必须唯一且非空,这是由__实体完整性规则
决定的。
33.设关系模式R(A,B,C),F是R上成立的FD集,F={A→B,B→C},
则分解ρ={AB,AC}丢失了FD_B→C。
34.如果关系模式R是1NF,并且不存在非主属性对关键码的局部依赖,那么R至少应该是 __2NF范式。
三、简答题(本大题共6小题)
35.试叙述概念模型与逻辑模型(即结构模型)的主要区别。
答:概念模型:①对现实世界的第一层抽象;②与软、硬件无关;
③从用户观点对数据建模。
逻辑模型:①对现实世界的第二层抽象;②与硬件无关,与软件有关;
③从计算机实现观点对数据建模。
36.数据库管理系统有哪些功能?
答:数据库管理系统(DBMS)是位于操作系统与用户之间的一个数据管理软件,它主要功能包括以下几个方面:
·数据定义功能DBMS提供数据描述语言(DDL),用户可通过它来定义数据。
·数据操纵功能DBMS还提供数据操纵语言(DML),实现对数据库的基本操作:查询、插入、删除和修改。
·数据库的运行管理这是DBMS运行时的核心部分,它包括开发控制,安全性检查,完整性约束条件的检查和执行,数据库的内容维护等。
·数据库的建立和维护功能它包括数据库初始数据的输入及转换,数据库的转储与恢复,数据库的重组功能和性能的监视与分析功能等37.设有关系R和S,其值如下:
R A B C S B C D
2 4 6 4 5 6
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat
bvi ousl y, face China's Socialist system, the Communist Party is not the party. In that ca se, political chaos has been very tight. Is remodeling or reconstr uction, is a corre ction or a stove. Whether to t urn right or left, is back t o the source or put forward new political i deas. This is to determine the road probl ems in China , is also the key out of the deep water of the reform of the economic system. After 18, the new Ce ntral coll ective lea dership attaches great importa nce t o political or ientation. First, the "Central eight articles" as a starting poi nt, starting from the Central Gov ernment's self -restraint, w hich prea ches a nd pro-image, br ought fresh feeling to the community. Secondl y, before reform and openi ng up and reform and ope ning tw o peri ods after non-negative, untyi ng the tangle of the society a long time on this issue. Third, a new ge neration of party lea ders on various occasions to Ma o Ze-Dong a nd M ao Ze -Dong's
thoug ht of evaluation ha s room for manoeuvre , through to the ruling i de ology of Ma o Zedong thought, i s the call of the soul to t he Socialist Revol ution a nd construction. Empty talks je opardi ze nati onal i nterests and try again, is a n affirmation of De ng Xia o-ping's reform ideas. These strong political signal showing a new generation of politi cal leader s is still kee ping to t he Socialist roa d. Four is revisiting the "talking to Mao Ze -Dong's histori cal cy cle of" high profile anti -corruption and t he importance of the Constit ution, reorganization is ba d style of official dom, was t o civilize pe ople obey the law , w hile impr oving the col or change of the regime of vigilance. Five is to reform into deeper waters a nd stresse d that top -level design, this i s a review on the reform and openi ng up i n the past, is also looking for a way out. Six foreign and Russia cl oser, the flexible attit ude on the i ssue of the Korean peni nsula, Sino-Ja
pane se fishi ng
hardli ne China on the island out of the "patie nt" and low profile sha dow began to gradually pl an development. Signs show that the new lea dership began to make a left turn i n politics. However, as of right now, not only i deological confusi on i n the communit y, the new lea dership's t hinki ng is messy. New lea ders both stressed t he nee d to impleme nt the Constitution, stressed the nee d to tur n off the power in a cage. Also stresse s that Ma o Zedong thought cannot be l ost, 30 year s after the reform and ope ning up 30 years ag o ca n not deny ea ch other. Both adv ocate democra cy and rele ase "seven does not speak of" files of political constraints. Neither deny t he hist ory of the CPC Central Committee on several i ssues ...
3 6 9
4 6 8
3 4 5 6 8 0
6 9 2
试求R ?S 、R ?S 的值。
解:R ?S A B C D R ?S
A R.
B R.
C S.B S.C
D 2 4 6 8
2 4 6 4 5 6
3 6 9 2
2 4 6 4 6 8
3
4
5 6
3 6 9 6 8 0
3 6 9 6 9 2
3 4 5 4 5 6
3 4 5 4 6 8
38. 什么是数据库系统的三级模式结构?
答:数据库系统的三级模式结构是指数据库系统是由外模式、模式和内模式三级构成。
模式:也称逻辑模式,是数据库中全体数据的逻辑结构和特征的描述,是所有用户
的公共数据视图。
外模式:也称子模式(Subschema )或用户模式,它是数据库用户(包括应用程序
员和最终用户)能够看见和使用的局部数据的逻辑结构和特征的描述,是数据库用户的
数据视图,是与某一应用有关的数据的逻辑表示。
内模式:也称存储模式(StoragC SChema );一个数据库只有一个内模式。
它是数
据物理结构和存储方式的描述,是数据在数据库内部的表示方式。
39.设有关系R 和S ,其值如下:
R A B C S D B C 2 4 6 3
5 6 2 5 6 2
4 7 3 4 7 2
5 6 4 4 7 2
4 8
试求R ?S 、R ?S 的值。
解:R ?S
A B C D R ?S A R.B R.C D S.B S.C
2 5 6
3 3
4 7 3
5 6
2 5 6 2
3
4 7 2
5
6 3 4
7 2
4 4 7 3
5
6 2=1 3>3 3>3
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat
4 4 7 2 4 4 7 2
5 6
40.数据库系统的故障有哪些类型?恢复系统的主要功能是什么?
答:事务故障
系统故障
介质故障
恢复子系统的功能就是利用冗余数据,再根据故障的类型采取相应的恢复措施,把数据库恢复到故障前的某一时刻的一致性状态。
四、设计题(本大题共4小题)
41.试写出下列删除操作的SQL语句:
从SC表中把Wu老师的女学生选课元组删去。
解:DELETE FROM SC
WHERE SNO IN (SELECT SNO FROM S WHERE SEX='F')
AND CNO IN (SELECT CNO FROM C WHERE TEACHER='Wu');
42.试用SQL的断言来表达下列约束:
规定女同学选修LIU老师的课程成绩都应该在70分以上。
解:CREATE ASSERTION ASSE8 CHECK
(70 < ALL(SELECT GRADE
FROM S, SC,C
WHERE S.SNO=SC.SNO AND
/doc/967288236.html,O=http://www.docz /doc/967288236.html,O
AND SEX='M' AND TEACHER='LIU'));
43.试写出下列修改操作的SQL语句:
把Wu老师的女同学选课成绩增加4% 。
解:UPDATE SC
SET GRADE=GRADE*1.04
WHERE SNO IN (SELECT SNO FROM S WHERE SEX='F')
AND CNO IN (SELECT CNO FROM C WHERE TEACHER='Wu');
44.试用SQL的断言来表达下列约束:
规定每个女同学最多选课6门。
解:CREATE ASSERTION ASSE8 CHECK
(6 >= ALL(SELECT COUNT(CNO)
FROM S, SC
WHERE S.SNO=SC.SNO AND SEX='M'
GROUP BY S.SNO));
五、综合题(本大题共4小题)
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat 45.设工厂里有一个记录职工每天日产量的关系模式:
R(职工编号,日期,日产量,车间编号,车间主任)。
如果规定:每个职工每天只有一个日产量;
每个职工只能隶属于一个车间;
每个车间只有一个车间主任。
试回答下列问题:
⑴根据上述规定,写出模式R的基本FD和关键码;
⑵说明R不是2NF的理由,并把R分解成2NF模式集;
⑶进而再分解成3NF模式集,并说明理由。
解:①基本的FD有3个:
(职工编号,日期)→日产量
职工编号→车间编号
车间编号→车间主任
R的关键码为(职工编号,日期)。
②R中有两个这样的FD:
(职工编号,日期)→(车间编号,车间主任)
职工编号→(车间编号,车间主任)
可见前一个FD是局部依赖,所以R不是2NF模式。
R应分解成R1(职工编号,车间编号,车间主任)
R2(职工编号,日期,日产量)
此处,R1和R2都是2NF模式。
③R2已是3NF模式。
在R1中,存在两个FD:职工编号→车间编号
车间编号→车间主任
因此,“职工编号→车间主任”是一个传递依赖,R1不是3NF模式。
R1应分解成R11(职工编号,车间编号)
R12(车间编号,车间主任)
这样,ρ= { R11,R12,R2 }是一个3NF模式集。
bvi ousl y, face China's Socialist system, the Communist Party is not the party. In that ca se, political chaos has been very tight. Is remodeling or reconstr uction, is a corre ction or a stove. Whether to t urn right or left, is back t o the source or put forward new political i deas. This is to determine the road probl ems in China, is also the key out of the deep water of the reform of the economic system. After 18, the new Ce ntral coll ective lea dership attaches great importa nce t o political or ientation. First, the "Central eight articles" as a starting poi nt, starting from the Central Gov ernment's self-restraint, w hich prea ches a nd pro-image, br ought fresh feeling to the community. Secondl y, before reform and openi ng up and reform and ope ning tw o peri ods
after non-negative, untyi ng the tangle of the society a long time on this issue. Third, a new ge neration of party lea ders on various occasions to Ma o Ze-Dong a nd M ao Ze-Dong's thoug ht of evaluation ha s room for manoeuvre, through to the ruling i de ology of Ma o Zedong thought, i s the call of the soul to t he Socialist Revol ution a nd construction. Empty talks je opardi ze nati onal i nterests and try again, is a n affirmation of De ng Xia o-ping's reform ideas. These strong political signal showing a new generation of politi cal leader s is still kee ping to t he Socialist roa d. Four is revisiting the "talking to Mao Ze-Dong's histori cal cy cle of" high profile anti-corruption and t he importance of the Constit ution, reorganization is ba d style of official dom, was t o civilize pe ople obey the law, w hile impr oving the col or change of the regime of vigilance. Five is to reform into deeper waters a nd stresse d that top-level design, this i s a review on the reform and openi ng up i n the past, is also looking for a way out. Six foreign and Russia cl oser, the flexible attit ude on the i ssue of the Korean peni nsula, Sino-Ja pane se fishi ng hardli ne China on the island out of the "patie nt" and low profile sha dow began to gradually pl an development. Signs show that the new lea dership began to make a left turn i n politics. However, as of right now, not only i deological confusi on i n the communit y, the new lea dership's t hinki ng is messy. New lea ders both stressed t he nee d to impleme nt the Constitution, stressed the nee d to tur n off the power in a cage. Also stresse s that Ma o Zedong thought cannot be l ost, 30 year s after the reform and ope ning up 30 years ag o ca n not deny ea ch other. Both adv ocate democra cy and rele ase "seven does not speak of" files of political constraints. Neither deny t he hist ory of the CPC Central Committee on several i ssues ...
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat 46.某学员为公安局的车辆信息管理系统设计了数据库的ER 图,对车辆、车主、驾驶
员、制造商、保险公司、警察、车辆违章和车辆事故等信息进行了管理,其ER 图如下
所示。
该ER 图有7个实体类型,其结构如下:
制造商(制造商编号,名称,地址)
交通管理大队(大队编号,地址,区域,电话)
警察(警号,姓名,性别,出生年月)
车主(身份证号,姓名,地址,电话)
车辆(车辆牌号,型号,发动机号,座位数,登记日期)
驾驶员(驾驶证号,姓名,性别,地址,准驾车型,发证日期)保险公司(保险公司编号,名称,地址,电话)
该ER 图有8个联系类型,其中5个是1:N 联系,1个是M:N 联系,2个是M:N:P 联
系。
其联系的属性如下:
违章(违章编号,时间,地点,违章行为,处理结果)
事故(事故编号,时间,地点,事故简要,处理结果)
被盗(被盗编号,被盗时间,被盗地点,找回时间,找回地点)试将上述ER 图转换成关系模型:
① 写出关系模式集,并用下划线和波浪线标识出每个模式的主键和外键。
② 在上述数据库中,写出主键和外键的总数这两个数字。
1
N
N P M M N N 制造商车辆保险公司车主驾驶员警察
交通管理大队被盗拥有管理
保险2 事故
制造违章保险1 1 1
M 1 1 N N N N P
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat 解:①根据ER图和转换规则,7个实体类型转换成7个关系模式,1个M:N联系转换成1个关系模式,2个M:N:P联系转换成2个关系模式。
因此,该ER图可转换成10个关系模式,如下:
制造商(制造商编号,名称,地址)
交通管理大队(大队编号,地址,区域,电话)
警察(警号,姓名,性别,出生年月,大队编号)
车主(身份证号,姓名,地址,电话)
车辆(车辆牌号,型号,发动机号,座位数,登记号,制造商编号,保险公司编号,车主身份证号)
驾驶员(驾驶证号,姓名,性别,地址,准驾车型,发证日期,保险公司编号)
保险公司(保险公司编号,名称,地址,电话)
违章(违章编号,时间,地点,违章行为,处理结果,车辆牌号,驾驶证号,警号)
事故(事故编号,时间,地点,事故简要,处理结果,车辆牌号,驾驶证号,警号)
被盗(被盗编号,被盗时间,被盗地点,找回时间,找回地点,车主身份证号,车辆牌号)
②在上述数据库中,主键的总数为10个,外键的总数为13个。
47.设关系模式R(车间编号,零件编号,数量,仓库编号,仓库地址)。
如果规定:每个车间每需要一种零件只有一个数量;
每种零件只存放在一个仓库里;
每个仓库只有一个地址。
(1)试根据上述规定,写出模式R的基本FD和关键码。
(2)说明R不是2NF的理由,并把R分解成2NF模式集。
(3)再进而分解成3NF模式集,并说明理由。
解:①基本的FD有3个:
(车间编号,零件编号)→数量
零件编号→仓库编号
仓库编号→仓库地址
R的关键码为(车间编号,零件编号)。
②R中有两个这样的FD:
(车间编号,零件编号)→(仓库编号,仓库地址)
零件编号→仓库编号,仓库地址)
可见前一个FD是局部依赖,所以R不是2NF模式。
bvi ousl y, face China's Socialist system, the Communist Party is not the party. In that ca se, political chaos has been very tight. Is remodeling or reconstr uction, is a corre ction or a stove. Whether to t urn right or left, is back t o the source or put forward new political i deas. This is to determine the road probl ems in China, is also the key out of the deep water of the reform of the economic system. After 18, the new Ce ntral coll ective lea dership attaches great importa nce t o political or ientation. First, the "Central eight articles" as a starting poi nt, starting from the Central Gov ernment's self-restraint, w hich prea ches a nd pro-image, br ought fresh feeling to the community. Secondl y, before reform and openi ng up and reform and ope ning tw o peri ods after non-negative, untyi ng the tangle of the society a long time on this issue. Third, a new ge neration of party lea ders on various occasions to Ma o Ze-Dong a nd M ao Ze-Dong's
thoug ht of evaluation ha s room for manoeuvre, through to the ruling i de ology of Ma o Zedong thought, i s the call of the soul to t he Socialist Revol ution a nd construction. Empty talks je opardi ze nati onal i nterests and try again, is a n affirmation of De ng Xia o-ping's reform ideas. These strong political signal
showing a new generation of politi cal leader s is still kee ping to t he Socialist roa d. Four is revisiting the "talking to Mao Ze-Dong's histori cal cy cle of" high profile anti-corruption and t he importance of the Constit ution, reorganization is ba d style of official dom, was t o civilize pe ople obey the law, w hile impr oving the col or change of the regime of vigilance. Five is to reform into deeper waters a nd stresse d that top-level design, this i s a review on the reform and openi ng up i n the past, is also looking for a way out. Six foreign and Russia cl oser, the flexible attit ude on the i ssue of the Korean peni nsula, Sino-Ja pane se fishi ng
hardli ne China on the island out of the "patie nt" and low profile sha dow began to gradually pl an development. Signs show that the new lea dership began to make a left turn i n politics. However, as of right now, not only i deological confusi on i n the communit y, the new lea dership's t hinki ng is messy. New lea ders both stressed t he nee d to impleme nt the Constitution, stressed the nee d to tur n off the power in a cage. Also stresse s that Ma o Zedong thought cannot be l ost, 30 year s after the reform and ope ning up 30 years ag o ca n not deny ea ch other. Both adv ocate democra cy and rele ase "seven does not speak of" files of political constraints. Neither deny t he hist ory of the CPC Central Committee on several i ssues ...
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat R 应分解成R1(零件编号,仓库编号,仓库地址)
R2(车间编号,零件编号,数量)此处,R1和R2都是2NF 模式。
③ R2已是3NF 模式。
在R1中,存在两个FD :零件编号→ 仓库编号
仓库编号→ 仓库地址
因此,“零件编号→ 仓库地址”是一个传递依赖,R1不是3NF 模式。
R1应分解成R11(零件编号,仓库编号)
R12(仓库编号,仓库地址)
这样,ρ= { R11,R12,R2 }是一个3NF 模式集。
48.某学员为高校社团信息管理系统设计了数据库的ER 图,对学生、社团、社团成员、
社团活动、主管老师、对活动和成员的评价等信息进行了管理,其ER 图如下所示。
该ER 图有9个实体类型,其结构如下:
学生(学号,姓名,性别,出生年月,政治面貌)
社团(社团编号,类别,名称,成员数,组织描述,活动概览)M M N N
N 1 1 社团活动成为社团能力状况学生评语奖励信息社团成员活动评价主管老师产生评价
参加主管具有属于有获得开展
N
N N N N N
1 1 1 1 1 1 1
State key protection of capital i nterests rather than the i nterests of citi zens, ha d bee n hits t he bottom of the pr oletariat 社团成员(成员编号,在社职务,证件编号,发放日期)
主管老师(教师工号,姓名,性别,政治面貌,职称,电话)
社团活动(社团活动编号,活动日期,主题,参加成员数,活动级别,活动内容)
活动评价(社团活动编号,评价日期,评分,说明)
奖励信息(奖励序号,奖励日期,奖项,奖励描述)
能力状况(序号,日期,健康状况,体育特长,文学特长,艺术特长)
评语(序号,日期,等级,描述,评语教师)
该ER图有10个联系类型,其中1个是1:1联系,7个是1:N联系,2个是M:N联系。
其联系的属性如下:
参加(参加情况评级)
开展(开展日期)
试将上述ER图转换成关系模型:
①写出关系模式集,并用下划线和波浪线标识出每个模式的主键和外键。
②在上述数据库中,写出主键和外键的总数这两个数字。
解:①根据ER图和转换规则,9个实体类型转换成9个关系模式,2个M:N联系转换成2个关系模式。
因此,该ER图可转换成11个关系模式,如下:
学生(学号,姓名,性别,出生年月,政治面貌)
社团(社团编号,类别,名称,成员数,组织描述,活动概览,主管教师工号)
社团成员(成员编号,学号,在社职务,证件编号,发放日期,社团编号)
主管老师(教师工号,姓名,性别,政治面貌,职称,电话)
社团活动(社团活动编号,活动日期,主题,参加成员数,活动级别,活动内容)
活动评价(社团活动编号,评价日期,评分,说明,主管教师工号)
奖励信息(奖励序号,成员编号,奖励日期,奖项,奖励描述)
能力状况(序号,成员编号,日期,健康状况,体育特长,文学特长,艺术特长)
评语(序号,成员编号,日期,等级,描述,评语教师)
参加(社团活动编号,成员编号,参加情况评级)
开展(社团编号,社团活动编号,开展日期)
②在上述数据库中,主键的总数为11个,外键的总数为12个。
bvi ousl y, face China's Socialist system, the Communist Party。