BCNF decomposition process

2020-05-08 10:35发布

问题:

What is the BCNF decomposition for these dependencies?

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

What is the process to get to the answer?

回答1:

We can first convert the relation R to 3NF and then to BCNF.

To convert a relation R and a set of functional dependencies(FD's) into 3NF you can use Bernstein's Synthesis. To apply Bernstein's Synthesis -

  • First we make sure the given set of FD's is a minimal cover
  • Second we take each FD and make it its own sub-schema.
  • Third we try to combine those sub-schemas

For example in your case:

R = {A,B,C,D,E}
FD's = {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)

  • Singleton RHS: We write the FD's with singleton RHS. So now we have FD's as {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. So now we have FD's as {A->B, A->C, A->D, B->D, B->E, B->D, D->A}
  • No redundant FD's: We remove the redundant dependencies. Now FD's are {A->B, A->C, B->D, B->E, D->A}

Second we make each FD its own sub-schema. So now we have - (the keys for each relation are in bold)

R1={A,B}
R2={A,C}
R3={B,D}
R4={B,E}
R5={D,A}

Third we see if any of the sub-schemas can be combined. We see that R1 and R2 have the LHS so they can be combined. Similarly R3 and R4 can be combined. So now we have -

S1 = {A,B,C}
S2 = {B,D,E}
S3 = {D,A}

This is in 3NF. Now to check for BCNF we check if any of these relations (S1,S2,S3) violate the conditions of BCNF (i.e. for every functional dependency X->Y the left hand side (X) has to be a superkey) . In this case none of these violate BCNF and hence it is also decomposed to BCNF.