简体   繁体   English

BCNF分解过程

[英]BCNF decomposition process

What is the BCNF decomposition for these dependencies? 这些依赖项的BCNF分解是什么?

A->BCD
BC->DE
B->D
D->A

What is the process to get to the answer? 得到答案的过程是什么?

We can first convert the relation R to 3NF and then to BCNF. 我们可以先将关系R转换为3NF,然后转换为BCNF。

To convert a relation R and a set of functional dependencies( FD's ) into 3NF you can use Bernstein's Synthesis . 要将关系R和一组功能依赖项( FD's )转换为3NF ,可以使用Bernstein的Synthesis To apply Bernstein's Synthesis - 应用伯恩斯坦综合-

  • First we make sure the given set of FD's is a minimal cover 首先,我们确保给定的FD's集是最小覆盖范围
  • Second we take each FD and make it its own sub-schema. 其次,我们获取每个FD并使其具有自己的子模式。
  • Third we try to combine those sub-schemas 第三,我们尝试将这些子方案结合起来

For example in your case: 例如,在您的情况下:

R = {A,B,C,D,E} R = {A,B,C,D,E}
FD's = {A->BCD,BC->DE,B->D,D->A} FD = {A-> BCD,BC-> DE,B-> D,D-> A}

First we check whether the FD's is a minimal cover ( singleton right-hand side , no extraneous left-hand side attribute, no redundant FD ) 首先,我们检查FD's是否为最小覆盖率( 单例右侧,无多余左侧属性,无冗余FD

  • Singleton RHS: We write the FD's with singleton RHS. 单例RHS:我们用单例RHS编写FD。 So now we have FD's as {A->B, A->C, A->D, BC->D, BC->E, B->D, D->A} 因此,现在我们的FD为{A-> B,A-> C,A-> D,BC-> D,BC-> E,B-> D,D-> A}
  • No extraneous LHS attribute: We remove the extraneous LHS attribute C from FD BC->D and BC->E . 没有多余的LHS属性:我们从FD BC->DBC->E删除了多余的LHS属性C So now we have FD's as {A->B, A->C, A->D, B->D, B->E, B->D, D->A} 因此,现在我们的FD为{A-> B,A-> C,A-> D,B-> D,B-> E,B-> D,D-> A}
  • No redundant FD's: We remove the redundant dependencies. 无冗余FD:我们删除了冗余依赖项。 Now FD's are {A->B, A->C, B->D, B->E, D->A} 现在,FD为{A-> B,A-> C,B-> D,B-> E,D-> A}

Second we make each FD its own sub-schema. 其次,我们使每个FD都有自己的子模式。 So now we have - ( the keys for each relation are in bold ) 现在我们有了-( 每个关系的键都以粗体显示

R 1 ={ A ,B} R 1 = { A ,B}
R 2 ={ A ,C} R 2 = { A ,C}
R 3 ={ B ,D} R 3 = { B ,D}
R 4 ={ B ,E} R 4 = { B ,E}
R 5 ={ D ,A} R 5 = { D ,A}

Third we see if any of the sub-schemas can be combined. 第三,我们看是否可以组合任何子模式。 We see that R 1 and R 2 have the LHS so they can be combined. 我们看到R 1R 2具有LHS,因此可以合并。 Similarly R 3 and R 4 can be combined. 类似地, R 3R 4可以组合。 So now we have - 所以现在我们有-

S 1 = { A ,B,C} S 1 = { A ,B,C}
S 2 = { B ,D,E} S 2 = { B ,D,E}
S 3 = { D ,A} S 3 = { D ,A}

This is in 3NF . 这是在3NF中 Now to check for BCNF we check if any of these relations (S 1 ,S 2 ,S 3 ) violate the conditions of BCNF ( ie for every functional dependency X->Y the left hand side ( X ) has to be a superkey ) . 现在检查BCNF,我们检查这些关系(S 1 ,S 2 ,S 3 )是否违反BCNF的条件( 即,对于每个函数依赖项X->Y ,左手边( X必须超键 ) 。 In this case none of these violate BCNF and hence it is also decomposed to BCNF . 在这种情况下,这些都没有违反BCNF ,因此也分解为BCNF

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM