Search code examples
databasedatabase-normalization3nf

About one of the conditions of 3NF


R = {A, B, C, D} functional dependencies F = {A -> B, B -> C, C -> D}

After processing of making it 3NF: we get {{A,B}, {B,C}, {C,D}}

Let's say X -> A represents each functional dependency.

X means left hand side and A means right hand side.

My main question is the second condition of 3NF--X is a superkey.

So X is a superkey of what?

of R = {A, B, C, D} or of each relation, {A,B}, {B,C} and {C,D}, in 3NF?

For example, B is a superkey also a candidate key of {B,C} but not a superkey or candidate key of R = {A, B, C, D}.

I am totally confused.


Solution

  • A relation is in 3NF if, for every X -> A in that relation, one of these conditions hold:

    • X contains A (that is, X -> A is trivial functional dependency), or
    • X is a superkey, or
    • Every element of A-X, the set difference between A and X, is a prime attribute.

    In the case of R = {A, B, C, D}, we have an FD B -> C such that:

    • B doesn't contain C, and
    • B isn't a superkey of R, and
    • C isn't a prime attribute of R.

    Therefore R isn't in 3NF.

    However, if we look at R1 = {B, C} in which B -> C, then:

    • B doesn't contain C, and
    • B is a superkey of R1, and
    • C isn't a prime attribute of R1.

    Therefore R1 is in 3NF.