Search code examples
sqldatabaserelationdatabase-normalizationfunctional-dependencies

Minimal key from Functional Dependancies


I have the following relation:

{ a , b , c , d , e , f , g , h }

With the following functional dependencies:

A -> B,C,D
A,D -> E
E,F,G -> H
F -> G,H

enter image description here

My understanding is that the minimal key for this relation is {a,f} , as you can reach b,c,d,e though a, and reach g,h from f.

However I am told the actual minimal key is {a,f,e}

Can anybody explain where I may be going wrong here?


Solution

  • You are correct. AFE is actually a superkey and not a (minimal) candidate key, while the only candidate key is AF. That AF is a candidate key can be easily proved by computing its closure using the Armstrong's axioms. Here is a derivation that uses the Primary and Secondary Rules:

    1. A → B C D  (given)
    2. F → G H (given)
    3. A F → B C D G H (by composition of 1. and 2.)
    4. A → D (by decomposition of 1)
    5. A → A D (by augmentation of 4)
    6. A D → E (given)
    7. A → E (by transitivity of 5 and 6)
    8. A F → B C D E G H (by composition of 3 and 7)
    9. A F → A B C D E F G H (by augmentation of 8)