数据库范式练习题

合集下载

数据库模拟试题+参考答案

数据库模拟试题+参考答案

数据库模拟试题+参考答案一、单选题(共82题,每题1分,共82分)1.数据库管理系统的作用描述,最恰当的是( )A、保障数据的易操作性B、保证数据的安全C、对数据进行集中管理,保障数据的安全性、共享性和一致性D、分散管理,保障数据处理的有效性和数据共享正确答案:C答案解析:数据库管理系统的目的就是对数据实施集中管理,提供相应的数据模型,保障数据的安全性、共享性和一致性。

2.关闭Access数据库可以使用的快捷键是 ( )A、Alt+F4B、Alt+ F + XC、Alt+ F +CD、Ctrl+O正确答案:C3.在access2010数据表中,要直接显示姓名中有“李”字的记录的方法是( )A、排序B、隐藏C、筛选D、冻结正确答案:C4.使用表设计器定义表中字段时,不是必须设置的内容是()A、数据类型B、字段大小C、说明D、字段名称正确答案:C5.关于主关键字(即主键)的说法正确的是( )。

A、主关键字的数据能够重复B、主关键字中不许有重复值和空值C、一个表可以设置多个主关键字D、主关键字只能是单一的字段正确答案:B答案解析:A.作为主关键字的字段,它的数据不能重复;C.一个表可以设置一个主关键字;D.主关键字可以是多字段。

6.在access中,用户在写入数据库期间,其他用户都无法使用该数据库,说明该用户在打开数据库时选取的打开方式是()A、共享方式B、只读方式C、独占方式D、独占只读方式正确答案:C答案解析:一旦用户采用独占方式打开,则当前用户可以对数据库进行读写,其他用户无法打开数据库。

7.为加快对某字段的查找速度,应该( )。

A、使该字段数据格式一致B、防止在该字段中输入重复值C、使该字段成为必填字段D、对该字段进行索引正确答案:D8.创建Access 2010数据库时,默认的文件保存目录在()A、TempB、PicturesC、DocumentsD、Desktop正确答案:C答案解析:创建数据库时,默认的保存路径在Documents(我的文档)。

数据库范式习题答案

数据库范式习题答案

Normalization Questions and AnswersDatabase Systems,CSCI4380-01Sibel AdalıOctober28,2002Question1Suppose you are given a relation R=(A,B,C,D,E)with the following functional dependencies:{CE→D,D→B,C→A}.a.Find all candidate keys.b.Identify the best normal form that R satisfies(1NF,2NF,3NF,or BCNF).c.If the relation is not in BCNF,decompose it until it becomes BCNF.At each step,identify a new relation,decompose and re-compute the keys and the normal forms they satisfy.Answer.a.The only key is{C,E}b.The relation is in1NFc.Decompose into R1=(A,C)and R2=(B,C,D,E).R1is in BCNF,R2is in2NF.Decompose R2 into,R21=(C,D,E)and R22=(B,D).Both relations are in BCNF.Question2Suppose you are given a relation R=(A,B,C,D,E)with the following functional de-pendencies:{BC→ADE,D→B}.a.Find all candidate keys.b.Identify the best normal form that R satisfies(1NF,2NF,3NF,or BCNF).c.If the relation is not in BCNF,decompose it until it becomes BCNF.At each step,identify a new relation,decompose and re-compute the keys and the normal forms they satisfy.Answer.a.The keys are{B,C}and{C,D}b.The relation is in3NFc.It cannot be put into BCNF,even if I remove D and put into a relation of the form(B,C,D)(I need C for the functional dependency),the resulting relation would not be in BCNF.Question3Suppose you are given a relation R=(A,B,C,D,E)with the following functional de-pendencies:BD→E,A→C.a.Show that the decomposition into R1=(A,B,C)and R2=(D,E)is lossy.You can show using any method.My suggestion is to show how spurious tuples result from this decomposition with respect to the table below:A B C D E12345183441b.Find a single dependency from a single attribute X to another attribute Y such that when you add the dependency X→Y to the above dependencies,the decomposition in part a is no longer lossy.Answer.a.If we were to decompose the relations into:A B C 123 183D E 45 44and then join the two(in this case with a cartesian product),we would get:A B C D E12345183451234418344Tuples2and3are not in the original relation.Hence,this decomposition is lossy.b.This decomposition cannot be made lossless.The problem is there is no longer a way to make sure BD→E holds across two relations since they do not share any attributes.However,a lossy decomposition of the form(A,B,C),(C,D,E)can be made lossless by adding an FD B→C. Question4You are given the following set of functional dependencies for a relation R(A,B,C,D,E,F), F={AB→C,DC→AE,E→F}.a.What are the keys of this relation?b.Is this relation in BCNF?If not,explain why by showing one violation.c.Is the decomposition(A,B,C,D)(B,C,D,E,F)a dependency preserving decomposition?If not, explain briefly.Answer.a.What are the keys of this relation?{A,B,D}and{B,C,D}.b.Is this relation in BCNF?If not,explain why by showing one violation.No,all functional dependencies are actually violating this.No dependency contains a superkey on its left side.c.Is the decomposition(A,B,C,D)(B,C,D,E,F)a dependency preserving decomposition?If not, explain briefly.Yes,AB→C and DC→A are preserved in thefirst relation.DC→E and E→F are preserved in the second relation.Question5You are given the below functional dependencies for relation R(A,B,C,D,E),F= {AB→C,AB→D,D→A,BC→D,BC→E}.a.Is this relation is in BCNF?If not,show all dependencies that violate it.b.Is this relation in3NF?If not,show all dependencies that violate it.2c.Is the following dependency implied by the above set of dependencies?If so,show how using the Amstrong’s Axioms given in the book(p.362-363):ABC→AEAnswer.Keys for the relation:{A,B},{B,D},{B,C}.a.Not in BCNF since D→A does have a superkey on the left hand side.b.In3NF since in D→A,A is part of a key.c.BC→E(given)ABC→AE by the augmentation rule.Question6You are given the table below for a relation R(A,B,C,D,E).You do not know the functional dependencies for this relation.This question is independent of Question2above.A B C D E’a’1221’s1’’a’’e’2364’e2’’b’’a’1991’b5’’c’’b’2132’z8’’d’Suppose this relation is decomposed into the following two tables:R1(A,B,C,D)and R2(A,C,E). Is this decomposition lossless?Explain your reasoning.Answer.R1A B C D ’a’1221’s1’’e’2364’e2’’a’1991’b5’’b’2132’z8’R2A C E’a’1’a’’e’4’b’’a’1’c’’b’2’d’R1 R2A B C D E’a’1221’s1’’a’’e’2364’e2’’b’’a’1991’b5’’c’’b’2132’z8’’d’’a’1221’s1’’a’’a’1991’b5’’c’Since the last two rows are not in the original relation,then this decomposition is lossy.Question7You are given the below set of functional dependencies for a relation R(A,B,C,D,E,F,G), F={AD→BF,CD→EGC,BD→F,E→D,F→C,D→F}.a.Find the minimal cover for the above set of functional dependencies using the algorithm described in class.Give sufficient detail to show your reasoning,but be succinct.You do not have to list all the cases you test/consider for the algorithm.Show all steps where you make changes to the above set in detail.ing the functional dependencies that you computed in step a,find the keys for this relation. Is it in BCNF?Explain your reasoning.c.Suppose we decompose the above relation into the following two relations:R1(A,B,C,D,E)R2(A,D,F,G)Use the functional dependencies in the minimal cover.For each relation,write down the functional dependencies that fall within that relation(you can decompose a dependency of the form AD→BF into two i.e.AD→B and AD→F when computing this).3Using these functional dependencies,determine if this decomposition is lossless and/or dependency preserving.Explain your reasoning.Answers.a.Step1.{AD→B,AD→F,CD→E,CD→G,CD→C,BD→F,E→D,F→C,D→F}Step2.removeCD→C,AD→F,and BD→F.{AD→B,CD→E,CD→G,F→C,D→F,E→D}Step3.remove D from CD→E and CD→G{AD→B,D→E,D→G,F→C,D→F,E→D}Finally recombine{AD→B,D→EGF,F→C,E→D}.b.Keys:{A,D},{A,E}.Not in BCNF since the last three functional dependencies do not have a superkey on the left hand side.c.R1(A,B,C,D,E)Dependencies:AD→B,D→E,E→D R2(A,D,F,G)Dependencies:D→GF.Not functional dependency preserving,the dependency F→C is not preserved.head(R1)∩head(R2)={A,D}R1:AD→ABCDE is not true since C is not implied by A,DR2:AD→ADF G is true since this is implied by D→GF as follows:AD→AD inclusion rule,since D→GF,use set accumulation rule,AD→ADGF.Hence,thisis a lossless decomposition.Question8You are given the following set F of functional dependencies for a relation R(A,B,C,D,E,F): F={ABC→D,ABD→E,CD→F,CDF→B,BF→D}.a.Find all keys of R based on these functional dependencies.b.Is this relation in Boyce-Codd Normal Form?Is it3NF?Explain your answers.c.Can the set F be simplified(by removing functional dependencies or by removing attributes from the left hand side of functional dependencies)without changing the closure of F(i.e.F+)? Hint.Consider the steps of the minimal cover algorithm.Do any of them apply to this functional dependency?Answer.a.Keys:{A,B,C}and{A,C,D}b.It is not in BCNF.Counterexample ABD→E and ABD is not a superkey.It is not in3NF.Counterexample ABD→E,and ABD is not a superkey and E is not prime attribute(part of a key).c.Let F’be obtained by replacing CDF→B with CD→B.According to F and F’,CD+={C,D,B,F}.Hence,we can remove F from this functional dependency without changing the meaning of the system.Question9Consider relation R(X,Y,Z).Relation R currently has three tuples:(6,4,2),(6,6, 8)and(6,4,8).Which of the following three functional dependencies can you infer do not holdfor relation R?Explain your answer.Y→X4Z→YXY→ZAnswer.Thefirst functional dependency holds,but the rest do not hold.The second and third tuples both have8for Z but different values of Y.Thefirst and third tuples both have6and4for X and Y but different values for Z.Question10Consider the relation R(V,W,X,Y,Z)with functional dependencies{Z→Y,Y→Z,X→Y,X→V,V W→X}.a)List the possible keys for relation R based on the functional dependencies above.b)Show the closure for attribute X given the functional dependencies above.c)Suppose that relation R is decomposed into two relations,R1(V,W,X)and R2(X,Y,Z).Is this decomposition a lossless decomposition?Explain your answer.Answer.a.{V,W},{X,W}b.X+={X,V,Y,Z}c.Yes it is lossless.To be lossless the attributes in common between the two relations must functionally determine all the attributes in one of the two relations.The only attribute in common is X and it functionally determines all the attributes in R2.Question11Given relation R(W,X,Y,Z)and set of functional dependencies F={X→W,W Z→XY,Y→W XZ}.Compute the minimal cover for F.Answer.Step1:X→W,W Z→X,W Z→Y,Y→W,Y→X,Y→ZStep2:Don’t need W Z→X,since W Z→Y and Y→XDon’t need Y→W,since Y→X and X→WThis leaves{X→W W Z→Y,Y→X,Y→Z}Step3:Only need to consider W Z→Y.Can’t eliminate W or Z.So nothing is eliminated.Step4:{X→W W Z→Y,Y→XZ}is the minimal coverQuestion12Given relation R(W,X,Y,Z)and set of functional dependencies G={Z→W,Y→XZ,XW→Y},where G is a minimal cover:a)Decompose R into a set of relations in Third Normal Form.b)Is your decomposition in part a)also in Boyce Codd Normal Form?Explain your answer. Answer.a.Possible keys:{Y},{X,Z},{W,X}R1=(Z,W),R2=(X,Y,Z),R3=(X,Y,W)b.Yes.In each of the three relations,the left side of the funcational dependencies that apply are superkeys for the relation.Hence,all three relations satisfy the definition of BCNF.Question13Consider a relation named EMP DEPT with attributes:ENAME,SSN,BDATE, ADDRESS,DNUMBER,DNAME,and DMGRSSN.Consider also the set G of functional depen-dencies for EMP DEPT:5G={SSN→ENAME BDAT E ADDRESS DNUMBER,DNUMBER→DNAME,DMGRSSM}.a)Calculate the closures SSN+and DNAME+with respect to G.b)Is the set of functional dependences G minimal?If not,find a minimal set of functional depen-dencies that is equivalent to G.c)List an update anomaly that can occur for relation EMP DEPT.d)List an insertion anomaly that can occur for relation EMP DEPT.e)List a deletion anomaly that can occur for relation EMP DEPT.Answer.a)SSN+={SSN,ENAME,BDAT E,ADDRESS,DNUMBER,DNAME,DMGRSSN}DNAME+={DNAME}b)It is minimal.c)Since every member of a department has a reference to the manager of that department(i.e., Dmgrssn),when the department manager changes this reference must be changed multiple places.This leads to the possibility of an inconsistency in the database if they are not all changed.d)You cannot enter data about a department until you have employees for the department.e)If you delete the last employee for a department,you lose all information about the department. Question14You are given the following functional dependencies for the”EMPLOYEE”relation. Explain whether the relation”EMPLOYEE”is BCNF and3NF?Database:EMPLOYEE(ssn,first-name,last-name,address,date-joined,supervisor-ssn) DEPARTMENT(dept-no,name,manager-ssn)WORKS-IN(employee-ssn,dept-no)INVENTORY(dept-no,item-id,quantity)ITEMS(item-id,item-name,type)Foreign keys:1.EMPLOYEE.supervisor-ssn and WORKS-IN.employee-ssn point to EMPLOYEE.ssn.2.WORKS-IN.dept-no and INVENTORY.dept-no point to DEPARTMENT.dept-no.3.INVENTORY.item-id points to ITEMS.item-id.{ssn→supervisor−ssn,ssn→first−name,ssn→last−name,ssn→date−joined,ssn→address,address→ssn}.Answer.In BCNF,since ssn and address are both keys of EMPLOYEE.6。

数据库题库及答案精选全文完整版

数据库题库及答案精选全文完整版

可编辑修改精选全文完整版数据库题库及答案数据库技术是计算机科学中重要的一部分,广泛应用于各个领域。

为了更好地学习和理解数据库知识,题库是一个非常有用的资源。

本文提供一些常见的数据库题目及其答案,希望对读者的学习和实践有所帮助。

一、选择题1. 在关系数据库中,用于描述记录之间的关系的是:a) 表格b) 行c) 列d) 键答案:a) 表格2. 数据库管理系统(DBMS)的主要功能包括:a) 数据的存储和管理b) 数据的查询和分析c) 数据的备份和恢复d) 数据的安全性控制答案:a) 数据的存储和管理、b) 数据的查询和分析、c) 数据的备份和恢复、d) 数据的安全性控制3. 关系数据库中,用于唯一标识一条记录的属性被称为:a) 主键b) 外键c) 候选键d) 索引答案:a) 主键4. 数据库的范式用于描述数据库的结构是否符合某种规范。

以下哪一项不是数据库的范式:a) 一范式b) 二范式c) 三范式d) 四范式答案:d) 四范式5. 在SQL语句中,用于插入新记录的关键字是:a) SELECTb) UPDATEc) INSERTd) DELETE答案:c) INSERT二、填空题1. 在关系数据库中,每一行都代表一个________。

答案:记录2. 数据库中具有相同属性的记录集合被称为____________。

答案:表3. 在关系数据库中,用于检索某一部分记录的语句是________。

答案:SELECT4. 数据库设计中常用的三个范式依次是一范式、二范式和__________。

答案:三范式5. 数据库表中,用于唯一标识一条记录的属性被称为________。

答案:主键三、应用题1. 请列举至少三种数据库管理系统(DBMS)的类型,并简要描述它们的特点。

答案:关系型数据库管理系统(RDBMS):采用表格的形式组织数据,具有高度结构化和强一致性的特点。

常见的关系型数据库管理系统有MySQL、Oracle、SQL Server等。

数据库原理--范式习题

数据库原理--范式习题

1.(8分)假设某公司销售业务中使用的订单格式如下:订单号:1145订货日期:09/15/2002 客户编号:1001客户名称:ABC 客户电话:8141763产品编号品名价格数量金额A 电源100.00 20 2000.00B 电表200.00 40 8000.00C 卡尺40.00 50 2000.00总金额:12000.00公司的业务规定:(1)订单号是唯一的,每张订单对应一个订单号;(2)一张订单可以订购多种产品,每一种产品可以在多个订单中出现;(3)一张订单有一个客户,且一个客户可以有多张订单;(4)每一个产品编号对应一种产品的品名和价格;(5) 每一个客户有惟一的客户编号。

试根据上述表格和业务规则设计关系模式:R(订单号,订货日期,客户编号,客户名称,客户电话,产品编号,品名,价格,数量)(1)指出该关系模式中的基本函数依赖(2)指出该关系模式的范式级别(要求按照各范式定义简要分析)(3)按3NF的定义将其分解为3NF,要求无损联结并保持函数依赖2.假设某企业集团数据库中有一关系模式R如下:R(商店编号,商品编号,商品库存数量,部门编号,负责人)如果规定:(1)每个商店的每种商品只在该商店的一个部门销售;(2)每个商店的每个部门只有一个负责人;(3)每个商店的每种商品只有一个库存数量。

试分析:(4)根据上述规定,写出关系模式R的基本函数依赖;(5)指出该关系模式R的候选码(6)指出该关系模式R的范式级别,为什么?若R不是3NF,将R分解为3NF。

3.建立一个描述学生情况的数据库:一个系有若干学生,但一个学生只属于一个系;一个系只有一名负责人;一个学生可以选修多门课程,每门课程有若干学生选修;每个学生学习每一门课程有一个成绩;学生(用学号SNO描述);系(用系名SDEPT描述);系负责人(用其姓名MN描述);课程(用课程名CNAME描述);成绩(G);假定建立了如下关系模式S(SNO, SEDPT, MN, CNAME, G) 试分析:(1)指出该关系模式中的函数依赖(2)指出该关系模式的范式级别(要求按照各范式定义简要分析)按3NF的定义将其分解为3NF,要求无损联结并保持函数依赖(要求解题过程)。

数据库范式练习题

数据库范式练习题

1、请简述满足1NF、2NF和3NF的基本条件。

并完成下题:某信息一览表如下,其是否满足3NF,若不满足请将其化为符合3NF的关系。

(本小题第一范式的关系应满足的基本条件是元组中的每一个分量都必须是不可分割的数据项。

第二范式,指的是这种关系不仅满足第一范式,而且所有非主属性完全依赖于其主码。

第三范式,指的是这种关系不仅满足第二范式,而且它的任何一个非主属性都不传递依赖于任何主关键字。

考生情况(考生编号,姓名,性别,考生学校)考场情况(考场号,考场地点)考场分配(考生编号,考场号)成绩(考生编号,考试成绩,学分)2、某信息一览表如下,其是否满足3NF,若不满足请将其化为符合3NF的配件关系:(配件编号,配件名称,型号规格)供应商关系(供应商名称,供应商地址)配件库存关系(配件编号,供应商名称,单价,库存量)3、简述满足1NF、2NF和3NF的基本条件。

并完成下题:已知教学关系,教学(学号,姓名,年龄,性别,系名,系主任,课程名,成绩),试问该关系的主键是什么,属于第几范式,为什么?如果它不属于3NF,请把它规范到3NF。

4、请确定下列关系的关键字、范式等级;若不属于3NF,则将其化为3NF 。

例1.仓库(仓库号,面积,电话号码,零件号,零件名称,规格,库存数量)例1答案:仓库号+零件号;1NF;仓库(仓库号,面积,电话号码)零件(零件号,零件名称,规格)保存(仓库号,零件号,库存数量)例2. 报名(学员编号,学员姓名,培训编号,培训名称,培训费,报名日期),每项培训有多个学员报名,每位学员可参加多项培训。

例2答案:学员编号+培训编号;1NF;学员(学员编号,学员姓名)培训(培训编号,培训名称,培训费)报名(学员编号,培训编号,报名日期)5、请确定下列关系的关键字、范式等级;若不属于3NF,则将其化为3NF,要求每个关系写一条记录。

(部门编号,部门名称,所在城市,员工编号,员工姓名,项目编号,项目名称,预算,职务,加入项目的日期)[注]职务指某员工在某项目中的职务。

数据库范式练习题

数据库范式练习题

1.求以下关系模式的键
(1)R(A,B,C,D),函数依赖为:F={D→B,B→D,AD→B,AC→D}。

(2)R(A,B,C,D,E,P),函数依赖为:F={A→D,E→D,D→B,BC→D,DC→A}。

(3)R(A,B,C,D,E),函数依赖为:F={A→BC,CD→E,B→D,E→A}。

2.试问下列关系模式最高属于第几范式,并解释其原因。

(1)R(A,B,C,D,E),函数依赖为:AB→CE,E→AB,C→D。

(2)R(A,B,C,D),函数依赖为:B→D,D→B,AB→C。

3.设有关系模式R(O,I,S,Q,D,B),其函数依赖集合为S→D,I→B,IS→Q,B→O。

试求:
(1)R的候选键。

(2)R所属的最高范式。

(3)如果R不属于3NF,将R分解为3NF(具有无损连接性和依赖保持性)。

4.某单位有一销售利润登记表,记录个部门年代、季度销售利润。

该表随着年代的增加,表的栏目也增加,如图所示。

现在要使用数据库进行管理,请设计关系模型。

要求关系模式必须属于BCNF 范式,指出主键和函数依赖。

5.某图书馆图书馆为每本图书作了一个借阅情况登记表,如图所示。

现在要使用数据库进行管理,请设计关系模型。

要求关系模式必须属于3NF范式,指出主键和函数依赖。

图书号:JSJ0001。

数据库练习题

数据库练习题

【例10】设F={A→BC,B→AC,C→A},对F进行 极小化处理。
判断A→C是否冗余。
设:G2={ A→B,B→A,B→C,C→A},
得:AG2+=ABC
∵ CAG2+
∴ A→C冗余。
判断B→A是否冗余。
设:G3={ A→B,B→C,C→A},
得:BG3+=BCA
∵ ABG3+
∴ B→A冗余
【例10】设F={A→BC,B→AC,C→A},对F进行 极小化处理。
例8.教材P234,18:现有一局部应用,包括两个实 体:“出版社”和“作者”,这两个实体是多对多 的联系,请设计适当的属性,画出E-R图,再将其 转换为关系模型(包括关系名、属性名、码和完整 性约束条件)。
解答: E-R图如下页图所示:
E-R图如下:
地址
出版社名称
联系电话
出版社号
作者号
出版社 n
要求:
1)给出该图书馆数据库的E-R图。
2)将E-R图转换为关系模型。
1)该图书馆数据库的E-R图如下:
姓名 读者号
地址 性别
读者 1
借阅 m
年龄 单位
借出日期 应还日期
书号 书名
图书 作者
出版社
2)转换后的关系模型为:
读者(读者号,姓名,地址,性别,年龄,单位) 图书(书号,书名,作者,出版社) 借阅(读者号,书号,借出日期,应还日期)
3)给出一个可串行化的调度如下:
T1 Slock B ,Y=B=2 Unlock B Xlock A
A=B+1, 写回A = 3 Unlock A
T2
Slock A 等待 等待 X=A=3 Unlock A Xlock B ,B=A+1 写回B = 4 Unlock B

数据库试题及答案

数据库试题及答案

数据库试题及答案一、选择题(每题2分,共20分)1. 数据库管理系统(DBMS)的主要功能是______。

A. 数据存储B. 数据管理C. 数据保护D. 数据备份答案:B2. 在关系数据库中,数据是按照______存储的。

A. 记录B. 表格C. 索引D. 视图答案:B3. SQL语言中的“SELECT”语句用于执行______。

A. 数据更新B. 数据查询C. 数据删除D. 数据插入答案:B4. 以下哪个不是数据库设计中的范式?A. 第一范式(1NF)B. 第二范式(2NF)C. 第三范式(3NF)D. 第四范式(4NF)答案:D5. 在数据库中,事务的ACID属性不包括以下哪一项?A. 原子性(Atomicity)B. 一致性(Consistency)C. 隔离性(Isolation)D. 可扩展性(Scalability)答案:D...(此处省略剩余选择题)二、简答题(每题10分,共30分)1. 简述数据库的三级模式结构是什么?答案:数据库的三级模式结构包括外模式(用户模式)、概念模式(逻辑模式)和内模式(存储模式)。

外模式是用户与数据库交互的视图,概念模式是数据库的全局逻辑结构,内模式是数据库的物理存储结构。

2. 解释什么是数据库的规范化,并说明其目的是什么?答案:数据库的规范化是将数据库设计成一种逻辑上更简单、更一致的形式的过程。

其目的是减少数据冗余,提高数据完整性,以及简化数据的维护。

3. 描述什么是数据库的并发控制,并举例说明其重要性。

答案:数据库的并发控制是指在多用户环境中,数据库管理系统(DBMS)用来确保多个事务可以安全地同时执行的机制。

例如,在银行系统中,多个用户可能同时进行转账操作,正确的并发控制可以确保每笔交易的准确性和一致性。

三、计算题(每题15分,共30分)1. 假设有一个学生表Student,包含字段:学号(S#),姓名(Sname),性别(Sex),年龄(Age)。

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

1、请简述满足1NF、2NF和3NF的基本条件。

并完成下题:某信息一览表如下,
第一范式的关系应满足的基本条件是元组中的每一个分量都必须是不可分割的数据项。

第二范式,指的是这种关系不仅满足第一范式,而且所有非主属性完全依赖于其主码。

第三范式,指的是这种关系不仅满足第二范式,而且它的任何一个非主属性都不传递依赖于任何主关键字。

考生情况(考生编号,姓名,性别,考生学校)
考场情况(考场号,考场地点)
考场分配(考生编号,考场号)
成绩(考生编号,考试成绩,学分)
2、某信息一览表如下,其是否满足3NF,若不满足请将其化为符合3NF的关系。

配件关系:(配件编号,配件名称,型号规格)
供应商关系(供应商名称,供应商地址)
配件库存关系(配件编号,供应商名称,单价,库存量)
3、简述满足1NF、2NF和3NF的基本条件。

并完成下题:已知教学关系,
教学(学号,姓名,年龄,性别,系名,系主任,课程名,成绩),试问该关系的主键是什么,属于第几范式,为什么?如果它不属于3NF,请把它规范到3NF。

4、请确定下列关系的关键字、范式等级;若不属于3NF,则将其化为3NF 。

例1.仓库(仓库号,面积,电话号码,零件号,零件名称,规格,库存数量)例1答案:
仓库号+零件号;1NF;
仓库(仓库号,面积,电话号码)
零件(零件号,零件名称,规格)
保存(仓库号,零件号,库存数量)
例2. 报名(学员编号,学员姓名,培训编号,培训名称,培训费,报名日期),每项培训有多个学员报名,每位学员可参加多项培训。

例2答案:
学员编号+培训编号;1NF;
学员(学员编号,学员姓名)
培训(培训编号,培训名称,培训费)
报名(学员编号,培训编号,报名日期)
5、请确定下列关系的关键字、范式等级;若不属于3NF,则将其化为3NF,要求每个关系写一条记录。

(部门编号,部门名称,所在城市,员工编号,员工姓名,项目编号,项目名称,预算,职务,加入项目的日期)
[注]职务指某员工在某项目中的职务。

部门(部门编号,部门名称,所在城市)
员工(员工编号,员工姓名,部门编号)
项目(项目编号,项目名称,预算)
工作(员工编号,项目编号,职务,加入项目的日期)。

相关文档
最新文档