Search code examples
databaserelational-databasedatabase-normalizationfunctional-dependencies

Can an attribute that only appears on the RHS of a Functional Dependency be a prime attribute?


I am working on a normalization problem and am hung up on whether the given relation is in 2NF form. The relation is given as R(A,B,C,D,E,F,G) and the set of FD's is given as:

{ A->B, B->AC, F->ACDE, ADE->FG }.

The candidate keys that I have found are {F, ADE, BDE, ACDE}. However I am a bit confused if ACDE is allowed to be a candidate key since from my understanding, in order for an attribute to appear in a key, it must either appear on the LHS or on BOTH the LHS and RHS of a functional dependency. If ACDE is a legal key, then would it violate 2NF since ADE is a subset of ACDE and can still generate the non-prime attribute G?


Solution

  • ACDE is not a candidate key, it is just a superkey. This can be easily seen if you consider that ACDE contains ADE, which is a candidate key.

    In fact C cannot be a prime attribute, since any attribute appearing only in the RHS of functional dependencies cannot be part of any key.

    So in this case there are only three candidate keys: ADE, BDE and F, and the relation is not in 2NF, since C, which is a not prime attribute, is determined from a proper subset of a candidate key. For instance, it is determined from B.