So I have this set of relation
AB->CDEF
G->H,I
ABJ->K
C->L
How should I decompose this? I am so confused. Am I supposed to find the set of super key first?
So I have this set of relation
AB->CDEF
G->H,I
ABJ->K
C->L
How should I decompose this? I am so confused. Am I supposed to find the set of super key first?
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 -
FD's
is a minimal coverFD
and make it its own sub-schema.For example in your case:
R = {A,B,C,D,E,F,G,H,I,J,K,L}
FD's = {AB->CDEF,G->HI,ABJ->K,C->L}
First we check whether the FD's
is a minimal cover (singleton right-hand side , no extraneous left-hand side attribute, no redundant FD)
Second we make each FD
its own sub-schema. So now we have - (the keys for each relation are in bold)
R1={A,B,C}
R2={A,B,D}
R3={A,B,E}
R4={A,B,F}
R5={G,H}
R6={G,I}
R7={A,B,J,K}
R8={C,L}
Third we combine all sub-schemas with the same LHS. So now we have -
S1 = {A,B,C,D,E,F}
S2 = {G,H,I}
S3 = {A,B,J,K}
S4 = {C,L}
Since none of the above decomposed relations contain contain a key of R, we need to create an additional relation schema that contains attributes that form of a key of R. This is to ensure lossless join decomposition that preserves dependencies. So we add -
S5 = {A,B,G,J}
ABGJ is the key of the original relation R
This is in 3NF. Now to check for BCNF we check if any of these relations (S1,S2,S3,S4,S5) 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.
Note - The importance of some of these steps may not be clear in this example. Have a look at other examples here and here.