上海交通大学:《数据库系统原理 The principle of Database System》教学资源_第三章习题与答案(第三版)

Exercise 3.2.1 Consider a relation with schema R(A,B,C,D)and FD' sAB→C,C→D and D→A a)What are all the nontrieval FD's that follow from the given FD's?you should restrict yourself to FD's with single attributes on the right side. b)What are all the keys of R? c)What are all the superkeys for R that are not keys? Solutions: a)Nontrivial FD's (Implied FD's) Given FD's:AB→C,C→D,D→A A+=A,B+=B,C+={C,D,A},D+={D,A} AB+=(A,B,C,D),AC+=(A,C,,D),AD+=(A,D), BC+=(B,C,D,A),BD+={B,D,A,C),CD+=(C,D,A) ABC+=ABD+=BCD+=(B,C,D,A}ACD+=(ACD) Answer is: C->A,AB->D,AC->D,BC->A,BC->D,BD->A,BD->C, CD->A,ABC->D,ABD->C,and BCD->A. b)AB,BC,and BD are keys c)ABC,ABD,BCD,and ABCD
Exercise 3.2.1 Consider a relation with schema R(A,B,C,D) and FD’ s ABC, CD and DA a) What are all the nontrieval FD’ s that follow from the given FD’ s? you should restrict yourself to FD’s with single attributes on the right side. b) What are all the keys of R? c) What are all the superkeys for R that are not keys? Solutions: a) Nontrivial FD’ s (Implied FD’ s) Given FD’ s: ABC, CD, DA A+=A, B+=B,C+={C,D,A},D+={D,A} AB+={A,B,C,D},AC+={A,C,,D},AD+={A,D}, BC+={B,C,D,A},BD+={B,D,A,C},CD+={C,D,A} ABC+= ABD+=BCD+={B,C,D,A} ACD+={ACD} Answer is: C->A, AB->D, AC->D, BC->A, BC->D, BD->A, BD->C, CD->A, ABC->D, ABD->C, and BCD->A. b) AB, BC, and BD are keys c) ABC, ABD, BCD, and ABCD

Exercises3.3.1(已作为课堂练习) a)R(A,B,C,D)with FD'sAB→C,C→D,D→A C)R(A,B,C,D)with FD'SAB→C,BC→D,CD→A, AD→B 1)Indicate all the BCNF violations. 2)Decompose the relations,as necessary into collections of relations that are in BCNE Solution a) 1)C->A,C->D,D->A,AC->D,CD->A 2)Key are AB,BC,and BD BCNF:R1(AC),R2(BC),R3(CD) Or R1(CD),R2(BC),R3(AD)or... Solution c) 1)indicate all the BCNF violations Consider the closures of all 15 nonempty subsets of (A,B,C,D). A+=A,B+=B,C+=C,and D+=D.Thus we get no new FD’S. AB+=BC+=CD+=AD+=ABCD,AC+=AC,and BD+=BD.Thus we get new nontrivial FD's:AB→D,BC→A,CD→B, AD→C
Exercises 3.3.1 (已作为课堂练习) a) R(A,B,C,D) with FD’ s ABC, CD, DA c) R(A,B,C,D) with FD’s ABC, BCD, CDA, ADB 1) Indicate all the BCNF violations. 2) Decompose the relations, as necessary into collections of relations that are in BCNF Solution a) 1) C->A, C->D, D->A, AC->D, CD->A 2) Key are AB, BC, and BD BCNF: R1(AC), R2(BC), R3(CD) Or R1(CD),R2(BC),R3(AD) or… Solution c) 1) indicate all the BCNF violations Consider the closures of all 15 nonempty subsets of {A,B,C,D}. A+=A, B+=B, C+=C, and D+=D. Thus we get no new FD’ s. AB+=BC+=CD+=AD+=ABCD, AC+=AC, and BD+=BD. Thus we get new nontrivial FD’ s: ABD, BCA, CDB, ADC

ABC+=ABD+=ACD+=BCD+=ABCD.Thus we get new nontrivial FD's:ABC→D,ABD→C,ACD→B,BCE→A. To sum up,we can deduce 8 new nontrivial FD' s from the given 4 FD's. From above,we find that AB,BC,CD and AD are keys,and that all the nontrivial FD's for R contain a key on the left side.Thus there' re no BCNF violations. 2)R(A,B,C,D)is already in BCNF. Exercise 3.5.2 Consider the relation courses(C,T,H,R,S,G),whose attributes may be thought of informally as course,teacher,hour, room,student and grade.FD's:C→T,HR→C,HT→R, HS→R,CS→G. a)what are all the keys for Courses? b)Verify that the given FD's are their own minimal basis. c)Use the 3NF synthesis algorithm to find a lossless-join, dependency-preserving decomposition of R into 3NF relations.Are any
ABC+=ABD+=ACD+=BCD+=ABCD. Thus we get new nontrivial FD’ s: ABCD, ABDC, ACDB, BCEA. To sum up, we can deduce 8 new nontrivial FD’ s from the given 4 FD’ s. From above, we find that AB, BC, CD and AD are keys, and that all the nontrivial FD’ s for R contain a key on the left side. Thus there ’ re no BCNF violations. 2) R(A,B,C,D) is already in BCNF. Exercise 3.5.2 Consider the relation courses(C,T,H,R,S,G),whose attributes may be thought of informally as course, teacher, hour, room, student and grade. FD’s: CT, HRC, HTR, HSR, CSG. a) what are all the keys for Courses? b) Verify that the given FD’s are their own minimal basis. c) Use the 3NF synthesis algorithm to find a lossless-join, dependency-preserving decomposition of R into 3NF relations. Are any

of the relations not in BCNE? Solution: a)key:HS b)implied FD's:CH→R,TH今C,HR今T,CTH→R,. c)They are the minimal basis.Because Right sides are single attributes.No FD can be removed.No attribute can be removed from a left side. d)According to 3NF synthesis,the relation is decomposed into R1(CT),R2 (HRC),R3(HTR),R4(HSR),R5(CSG)they are also in BCNF. Exercise 3.6.3 a),c) a)R(A,B,C,D)with MVD'sA→→B,A→→C c)A relation R(A,B,C,D)with MVD AB→→C,and FD B→D O Find all the 4NF violations Decompose the relations into a collection of relation schemas in 4NF Find the keys of the relation based on FD's a)Solutions:
of the relations not in BCNF? Solution: a) key: HS b) implied FD’s: CHR, THC, HRT,CTHR,… c) They are the minimal basis. Because Right sides are single attributes. No FD can be removed.No attribute can be removed from a left side. d) According to 3NF synthesis, the relation is decomposed into R1(CT),R2(HRC),R3(HTR),R4(HSR),R5(CSG) they are also in BCNF. Exercise 3.6.3 a), c) a) R(A,B,C,D) with MVD’ s AB, AC c) A relation R(A,B,C,D) with MVD ABC, and FD BD Find all the 4NF violations Decompose the relations into a collection of relation schemas in 4NF Find the keys of the relation based on FD’s a) Solutions:

Key is ABCD Derive al1MWD's:A→→CD,A→→BD Find all 4 NF violations based on the definition R1(AB)R2 (ACD)>R1(AB)is in 4NF,while R2(ACD) with A→→cD,andA→→C,therefore decompose into R21(AC)R22(AD) c)Solution 1)find all the 4NF violation: The first step is to know what a key for the relational schema is based on FD's .It's easy to see that ABC is the only key of R.So the given MVD'sAB→→C,B→D and derived MWD'sAB→→D,B→→AC are a114 NF violations. 2)Decompose the relations By using AB→→C,we decompose R into R1(A,B,C) and R2 (A,B,D).Now B->D is again a 4NF violation for R2 and we further decompose R2 into R21(B,D) and R22(A,B).R22 is a part of R1,so we omit it.Obviously,R1,R21 together constitute a 4NF decomposition of R
Key is ABCD Derive all MVD’ s : ACD, ABD Find all 4 NF violations based on the definition R1(AB) R2(ACD) R1(AB)is in 4NF, while R2(ACD) with ACD, and AC, therefore decompose into R21(AC)R22(AD) c) Solution 1) find all the 4NF violation: The first step is to know what a key for the relational schema is based on FD’s It’ s easy to see that ABC is the only key of R. So the given MVD’ s ABC, BD and derived MVD’ s ABD, BAC are all 4NF violations. 2) Decompose the relations By using ABC, we decompose R into R1(A,B,C) and R2(A,B,D). Now BD is again a 4NF violation for R2 and we further decompose R2 into R21(B,D) and R22(A,B). R22 is a part of R1, so we omit it. Obviously, R1, R21 together constitute a 4NF decomposition of R
按次数下载不扣除下载券;
注册用户24小时内重复下载只扣除一次;
顺序:VIP每日次数-->可用次数-->下载券;
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter8 Views, Indexes.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter7 Constraints and Triggers.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter6 The database Language SQL –as a tutorial.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter5 Algebraic and Logic Query languages.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter4 High-level Database Models.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter3 Design Theory for Relational Databases.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)chapter11 The semi-structured data model Structured data.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》课程教学资源(课件讲稿)Chapter1 Introduction.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》教学资源_intro.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第二章 8086系统结构.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第一章 绪论(毛义梅).pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第四章 汇编语言程序设计_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第四章 汇编语言程序设计.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第十章 串行通信和可编程接口芯片8251A_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第十一章 A/D和D/A转换_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第八章 可编程计数器_定时器8253_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第八章 可编程计数器/定时器8253及其应用.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第五章 存储器_习题及解答.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第五章 存储器.pdf
- 上海交通大学:《微机原理与接口技术》课程教学资源(课件讲稿)第二章 8086系统结构_习题及答案.pdf
- 上海交通大学:《数据库系统原理 The principle of Database System》教学资源_第二章习题与答案(第三版).doc
- 上海交通大学:《数据库系统原理 The principle of Database System》教学资源_Chapter 1 Introduction.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_15 Introduction to matlab.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_16 MATLAB environment short.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_19 Recursion 1.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_20 Looking Ahead.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Array and its Applications.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_examples on class design.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Expressions and Statements.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_files_DataBase Design.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Function.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Introduction to Computer and Programming.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Introduction to Vg101.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_objects and classes.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_programming style guide for C plusplus.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Random Number_Graphics.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_Start with C plusplus.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Lecture Notes_vector_string.pdf
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Recitation Notes_Recitation 1.ppt
- 上海交通大学:《程序设计基础》课程教学讲义(密西根学院)Recitation Notes_recitation 13.pdf