BCNF Decomposition ------------------- Given a relation R and a minimal set F of fds. R is not in BCNF, we compute the following decomposition: - Find any X->Y in F that violates BCNF., compute X+ in F. Create two new relation instead of R: R1 contains attributes in X+, and R2 contains all attributes in R except for attributes in (X+-X). - Compute projection of fds for R1 and R2, and if either one is not in BCNF, then apply BCNF decomposition recursively until all resulting relations are in BCNF. BCNF Decompositions are: - Guaranteed to be lossless! - Not guaranteed to be dependency preserving Ex: S(A,B,C,D) AB->C A->D x violates BCNF C->A X violates BCNF Key:AB A->D A+ = {A,D} S1(A,D) F1={A->D} in BCNF S2(A,B,C) (everything in S except for A+-{A} = {D}) F2 = {AB->C, C->A}, not in BCNF Decompose further using C->A: S21(A,C) F21 ={C->A} in BCNF S22(B,C) F22 ={} in BCNF Done! Resulting functional dependencies: S1(A,D) F1={A->D} in BCNF S21(A,C) F21 ={C->A} in BCNF S22(B,C) F22 ={} in BCNF ---> F1 union F21 union F22 = {A->D, C->A} clearly: AB->C in F is lost. ------------------------------- Additional Exercise for BCNF Decomposition! Ex: R(A,B,C,D,E,F) AB->C CD->EF F->A Keys: ABD, BDF, BCD Decompose using: CD->EF CD+ = {C,D,E,F,A} R1(A,C,D,E,F) F1 = {CD->EF, F->A}, Keys: CD, F->A violates BCNF R2(B,C,D) F2 = {} Key: BCD in BCNF everything in R, except CD+-{CD} = {E,F,A} Decompose using F->A R11(A,F) F11 = {A->F} Key: A , in BCNF R12(C,D,E,F) F12 = {CD->EF} Key: CD, in BCNF Resulting relations: AF CDEF BCD Check if using different sequence of fds, do I get different results?