Search code examples
databasefunctional-dependenciesdecomposition

Finding the key for R


R = {A, B, C, D, E, F, G, H, I, J}
F = 
{{A,B} -> {C}, 
{A}-> {D,E}, 
{B} -> {F}, 
{C}-> {B}, 
{F}->{G,H},
{D}->{I,J}

The question is: What is the key for R?

I assume based on how the question has been formulated that there is one single candidate key which they want me to find.

If i have AB+ i can determine all the attributes in the relation meaning AB is a superkey. The proper subsets of the superkey AB which are {A} and {B} are not superkeys, hence why AB then is a candidate key. But from what i can tell there is another candidate key aswell which we can find if we have AC+. Is this correct or am i making a mistake somewhere?


Solution

  • Yes, you are correct: assuming that F is a cover of the dependencies of R, the relation has two candidate keys: {A, B} and {A, C}.

    This can be easily shown by computing both {A,B}+ and {A,C}+.