Ogen
Ogen

Reputation: 6709

BCNF decomposition query

I have a relation R(A, B, C, D) with functional dependencies ABC --> D and D --> A.

The question was, does this have a BCNF, and the answer was as follows:

enter image description here

(c) ABCD is not in BCNF since D --> A and D is not a key. However, if we split up R as AD, BCD, we cannot preserve the dependency ABC --> D. So there is no BCNF decomposition.

Now my question is, I understand that ABC->D cannot be preserved if you split the relation R into R1(A,D) and R2(BCD) but what if you changed R2(BCD) to R2(ABCD). Wouldn't that preserve it then? Is there any reason we cannot do that?

Upvotes: 0

Views: 657

Answers (1)

philipxy
philipxy

Reputation: 15148

You are taking "So there is no BCNF decomposition" out of context in two ways. There is no (lossless) BCNF decomposition (1) into relations that are all smaller (per comment) (2) that preserves all FDs (per comment).

From this answer:

[O]ne can always losslessly decompose to 3NF while preserving FDs but BCNF might not preserve them. Nevertheless it's a lossless decomposition: the components, if holding projections of the original, will join to the original. But whenever the original would have had a given value, the components should be projections of it. (If they're not, an error has been made, so we want the DBMS to constrain the components appropriately.) So it is necessary but sufficient to constrain the components to be projections of the original. ABC is trivially so (because it is a key). This leaves us needing to require that AD = ABCD PROJECT {DA}. We say that the components must satisfy that "equality dependency".

You can always non-loss decompose to 5NF. You just might have to add equality dependency constraints if you want to constrain the components per the unpreserved FDs.

Upvotes: 3

Related Questions