Here's the decomposing algorithm I have:
R is a relation. F is the set of FD's
1.If an FD X ->Y in F violates BCNF
2. Compute X +.
3. Replace R by two relations with schemas:
4. R1 = X +
5. R2 = R – (X + – X )
6. Project the FD’s F onto R1 and R2
7. Recursively decompose R1 and R2 into BCNF
I'm having trouble performing the algorithm, so I'm asking for help. I searched through SO, but the algorithm that I found did not contain the projection part. I think there's some misunderstanding about the algorithm.
Suppose I Have A Relation R(LMNOPQRS)
, and my functional dependencies are D = {L->NQ, MNR->O, O->M, NQ->LS, S->OPR}
and I'm trying to perform the algorithm to get this relation into BCNF.
Here is what I tried:
I found that MNR->O
is one of the FD's that violates BCNF since it's not a superkey to the relation. So I decomposed them into two relations:
R1 = MNRO R2 = NQLSPRM
now the projection is my hardest part:
I tried to find the closure set of MNRO to project the FD's, and the FDs that satisfies the relation R1 is O->M
and MNR->O
. MNR is the key to the relation R1, but O is not. So do I just omit the O-M relation? or should I decompose further? Did I do my projection right?
Thank you in advance for the help.