Search code examples
databasedatabase-normalizationcandidate-key

Find 3 minimal keys in the following relation


I am trying to understand how to find minimal keys. The assignment provides me with the following task:

Find 3 minimal keys in relation (each key is a set of attributes).

R (a, b, c, d, e)

a  -> b
bc -> d
de -> a

The answer is:

(a, c, e)
(b, c, e)
(d, c, e)

I do not understand how to get to the answer. I would appreciate any guidance.


Solution

  • First of all, this website by Griffith University helped a lot ( they also show step by step BNCF normalization).

    Apparently, in this task minimal key is a candidate key.

    First step is to find attributes that exist in the relation R but not on the RightHandSide.

    (a b c d e) - (b d a) = c e  (Relation R - RHS)
    

    The second step is to find closures of the current candidate key. Closure of {c e} is {c e}. This does not help, therefore we need to include an extra attribute. We start from the (alhabetical) beginning:

    Closure of {c e a} = { c e a b d } Found one candidate key! 
    Closure of {c e b} = { c e b d a } Found another candidate key!
    We skip the c as it is already in the candidate key. 
    Closure of {c e d} = { c e d a b } Found the last candidate key! (the task was to find 3)