Search code examples
databaserelational-databasedatabase-schemadatabase-normalization

How to transform this into Boyce-Codd Normal Form?


I don't understand what I am doing wrong here. This is what I am being asked:

Normalize the following schema into BNCF:
T ((A, B), C, E, F, G)

The functional dependencies besides the key are:
A, B → C, E
F, B, A → G
B → B
F, C → C, G, E
C, F → E
E → G, E

So, I came up with this:

T ((A, B), C, E, F)
X((A,B), C, E)
W ((F,B,A), G)
Q ((B))
L ((F,C), G, E)
J ((C,F), E)
R ((E),G)

But it gives me this error:

Result is not as expected. Modify your input and try again.

And I have no clue where the error is. Can someone explain to me what I should do?


Solution

  • If the nested parentheses indicate a CK (candidate key) then

    A, B → C, E is implied by the CK
    F, B, A → G ditto
    B → B is trivial
    F, C → C, G, E is implied by F, C → G, E
    C, F → E is redundant given F, C → G, E
    E → G, E means F, C → G, E is implied by F, C → E

    {A, B} being a CK means A, B → C, E, F, G, plus we have F, C → E and E → G. We can use a BCNF algorithm to get a decomposition comprising ((A, B), C, F) plus your J ((C,F), E) and R ((E), G).

    You don't explain your solution (what BCNF algorithm you are using and what choices you made). But note that the FDs that hold in a relation are all the ones generated by Armstrong's axioms when some explicitly given ones hold. (Including the ones that hold because we were told a CK.) Also note that in one BCNF algorithm when we pick some FD (functional dependency) X → Y that holds in schema R that violates BCNF we replace R by schemas X+ and R - (X+ - X); and the set of FDs used is the closure of the explicitly given ones.