databasedatabase-normalizationbcnf

BCNF decomposition --- Am I doing this wrong?


I am working on lossless-join decomposition on the relation R(A,B,C,D,E).

The relation has functional dependencies: {A->BC,B->D,CD->E,E->A}

(1) I think candidate keys are {A} and {E}

(2) And BCNF violations are {B->D} and {CD->E}, because {B} and {CD} are not candidate keys

(3) But I don't know how to decompose it and which dependencies are not preserved. I guess it would be like...

=> R1={A,B,C,E}, R2={B,D} and lose FDs: {CD->E}

But both {A} and {E} are candidate keys, so does it need to be separated like below?

=> R1{A,B,C}, R2{B,D}, R3{B,C,E} and lose FDs: {CD->E}

I want to ask which one is correct


Solution

  • (1) is wrong, since also BC and CD are candidate keys (for instance, since CD → E and E is a candidate key, it is easy to see that also CD must be a candidate key). Another way of checking this is computing CD+:

    CD+ = CD
    CD+ = CDE (by using CD -> E)
    CD+ = CDEA (by using E -> A)
    CD+ = CDEAB (by using A -> BC)
    

    CD+ is equal to all the attributes of the relation and this means that it is a superkey. Moreover, since you cannot remove any attribute from with without losing the property of determining all the attributes of the relation, this means it is a candidate key.

    So B → D is the only dependency that violates the BCNF, and for this reason you can decompose R in R1(BD) with candidate key B and R2(ABCE) with candidate keys A, BC, and E. Both relations are in BCNF, so no further decomposition is necessary.

    Because of this decomposition, it is true that the dependency CD → E is lost.