I'm going over some practice questions.
F={ B→E, C→B, CD→E, ABE→C}
I tried to make a canonical cover -
Fc ={ B→E, C→B, D→E, AB→C}
Then finding candidate keys -
ADB, ADC
Is R in BCNF? I thought it isn't in BCNF if I do not do lossless and dependency preserving decomposition, so I decomposed so:
R1=(B,E) BCNF
R2=(C,B) BCNF
R3=(D,E) BCNF
R4=(A,B,C) BCNF
R5=(A,D,B) NF3
Alongside every decomposition I wrote what state I think it's in. Lastly I need to decompose R so that all relations are in BCNF, so that would mean decomposing R5 so that it's in BCNF, but I don't how to do that since I can't find D or A using functional dependencies.
Assuming that you have a relation
R(A, B, C, D, E)and a cover of its functional dependenciesF = { B→E, C→B, CD→E, ABE→C }, in the canonical cover the dependencyD→Eshould be eliminated (it cannot be derived in any way). InCD→Ethe attributeEis extraneous, sinceC+ = { CBE }, and the dependencyC→Eis redundant, since we have alreadyC→BandB→E.So a canonical cover is:
Since
Ddoes not appear in any dependency ofFc, it must be present in any candidate key (and you have correctly identified the only candidate keys,{ABD, ADC}).So we have that the relation is not in BCNF (each dependency in the canonical cover has a determinant which is not a superkey).
You can decompose the relation in several ways in BNCF, depending on which order you consider the dependencies, but those decompositions are not dependency preserving. For instance, if you decompose R in:
the dependency
AB→Cis lost. In particular, in this case does not exists a decomposition in BCNF such that all the original dependencies are preserved.A 3NF decomposition that maintain both data and dependencies is the following: