版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、COMP231 Tutorial 6Functional Dependencies and Normalization 2Review: We want to decompose SchemasDecompositionR=A,B,C,D,ER1=A,B,C, R2=D,ELossless-join decomposition (complete reproduction)Satisfy normal forms (BCNF or 3NF)Dependency preservingR = A,B,C,D,E. F = ABC, CD E, B D, EA .Is the following d
2、ecomposition a lossless join?1) R1 = A,B,C,R2 =A,D,E.2) R1 = A,B,C,R2 =C,D,E.1) Since R1 R2 = A, and A is a key for R1, the decomposition is lossless join.2)Since R1 R2 = C, and C is not a key for R1 or R2, the decomposition is not lossless join.Exercise 1: Lossless-join DecompositionR = A,B,C,D,E.F
3、 = ABC, CD E, B D, EA .R1 = A,B,C, R2 = A,D,E.Is the above decomposition dependency-preserving?No.CD E and B D are lost. Exercise 2 : FD-Preserving DecompositionBCNF: R is in BCNF if and only iffor each FD: X A in F+ThenA X (trivial FD), orX is a superkey for R In other words, the left part of any n
4、on-trivial dependency must be a superkey.* If we do not have redundancy in F, then for each X A , X must be a candidate key.* The decomposition is lossless-join but may not be dependency-preserving.Review: Boyce-Codd Normal Form3NF: R is in 3NF if and only iffor each FD: X A in F+A X (trivial FD), o
5、rX is a superkey for R, orA is prime attribute for R If a relation is in BCNF, it is in 3NF (since BCNF permits only the first two conditions).If every FD that does not contain extraneous (useless) attributes, then for each X A , X must be a candidate key, or A must belong to a candidate key.The dec
6、omposition is both lossless-join and dependency-preserving.Review: Third Normal FormR =(A, B, C, D).F = CD, CA, BC.Question 1: Identify all candidate keys for R.Question 2: Does R satisfy 3NF or BCNF?Question 3: Decompose R into a set of BCNF relations.Question 4: Decompose R into a set of 3NF relat
7、ions.Exercise 3R =(A, B, C, D).F = CD, CA, BC.Question 1: Identify all candidate keys for R. B+ = B (BB) = BC (BC) = BCD (CD) = ABCD (CA) so the candidate key is B. B is the ONLY candidate key, because nothing determines B: There is no rule that can produce B, except B B.Exercise 3 (cont)R =(A, B, C
8、, D).F = CD, CA, BC. Question 2: Does R satisfy 3NF or BCNF? R is not 3NF, because: CD causes a violation,CD is non-trivial (D C).C is not a superkey.D is not part of any candidate key.CA causes a violationSimilar to aboveBC causes no violation Since R is not 3NF, it is not BCNF either.Exercise 3 (c
9、ont)R =(A, B, C, D).F = CD, CA, BC.Question 3: Decompose R into a set of BCNF relations.CD, CA violas BCNF. Take CD: decompose R to R1= A, B, C , R2=C, D.R1 violates BCNF (because of CA)Decompose R1 to R11 = B, C R12 = C, A.Final decomposition: R2 = C, D, R11 = B, C, R12 = C, A.No more violations: F
10、inished!Exercise 3 (cont)Let R be the initial table with FDs FS=RUntil all relation schemes in S are in BCNFfor each R in S for each FD X Y that violates BCNF for RS = (S R) (R-Y) (X,Y)enduntilR =(A, B, C, D).F = CD, CA, BC.Question 4: Decompose R into a set of 3NF relations.Compute canonical cover
11、Fc = CDA, BC. Create a table for each functional dependency in Fc R1 = C, D, A, R2 = B, C.The table R2 contains the candidate key Finished. Exercise 3 (cont)Compute the canonical cover Fc of FS=for each FD XY in the canonical cover FcS=S(X,Y) if no scheme contains a candidate key for R Choose any ca
12、ndidate key CNS=S table with attributes of CNExercise 4R = (A, B, C, D) F = ABC, ABD, CA, DBIs R in 3NF, why? If it is not, decompose it into 3NFIs R in BCNF, why? If it is not, decompose it into BCNFExercise 4R = (A, B, C, D) F = ABC, ABD, CA, DBIs R in 3NF, why? If it is not, decompose it into 3NF
13、Yes. Find all the Candidate Keys: AB, BC, CD, AD Check all FDs in F for 3NF condition2. Is R in BCNF, why? If it is not, decompose it into BCNFNo. CA, C is not a superkey. Similar for DBBegin with CA or begin with DB get the same result: R1 = C, D, R2 = A, C, R3 = B, DMore Exercise 5R = (A, B, C, D)F = ABCD, DA 1. Identify all the candidate keys for RCandidate keys: ABC, BCD 2. Identify the highest normal form that R satisfiesR is in 3NF but not BCNF. 3. If R is not in BCNF, decompose it into a set of BCNF relations that
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- GB/T 44827-2024分子体外诊断检验尿液、静脉血清和血浆代谢组学检验前过程的规范
- GB/T 44776-2024航天器空间环境及其效应仿真分析通用要求
- GB/T 25085.1-2024道路车辆汽车电缆第1部分:术语和设计指南
- 2024年伐木劳务承包合同范本大全
- 2024年出售建筑砖头合同范本大全
- 2024年出口车架采购合同范本
- 丝印应用技术培训
- 2024年贵金属复合材料(含微型、异型)项目成效分析报告
- 2024年运输代理服务项目评估分析报告
- 2024至2030年中国高精度光电跟踪铣槽机数据监测研究报告
- 血糖监测及注意事项课件PPT
- 大葱栽培技术.ppt
- 列管式冷却器、GLC型冷却器尺寸表(共3页)
- 国家开放大学《数学思想与方法》形考任务参考答案
- SAPO_34分子筛表面酸性质的研究
- 110kV终端变变电站电气一次系统设计
- 货运证明范本
- 协会第五届换届选举筹备工作汇报
- 电机常用公差配合
- 幕墙使用、保养、维修说明书
- GB∕T 33014.2-2016 道路车辆 电气电子部件对窄带辐射电磁能的抗扰性试验方法 第2部分:电波暗室法
评论
0/150
提交评论