




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 江苏南京玄武区南京田家炳高级中学2024~2025学年高二下册6月期末考试数学试题学生卷
- 必修二综合检测基础卷人教A版2019必修第二册学生卷
- 边缘计算信托投资与数字孪生技术结合研究考核试卷
- 内陆养殖品种选育与推广考核试卷
- 金属加工机械制造智能监控与故障预警系统开发考核试卷
- 派遣用工法律法规培训课程更新考核试卷
- 2025年中国PU涂料数据监测报告
- 2025年中国PET铝膜数据监测报告
- 2025年中国J型车门防撞条数据监测研究报告
- 2025年中国DVD解码器数据监测研究报告
- 2025年中学教师资格考试《综合素质》教育法律法规经典案例分析及强化试题集(含答案)
- CGF生长因子在口腔医学中的应用
- 互联网新闻信息服务安全评估报告模板(2025年7月修订)
- 《等腰三角形的性质》课件
- 工业互联网与船舶行业融合应用参考指南 2025
- 应征公民政治考核表(含示例)
- 南通国家级南通经济技术开发区公开招聘招商人员笔试历年参考题库附带答案详解析
- 2025年广东省深圳市中考道德与法治 总复习法治教育检测卷(含答案)
- 先天性甲状腺功能减退症诊治指南(2025)解读
- (2025)公文写作考试题库(含答案)
- 《心血管系统超声检查》课件
评论
0/150
提交评论