Search code examples
databasefunctional-dependenciesdatabase-theory

Does minimality of superkey guarantee it to be the candidate key?


Determine the candidate keys and superkeys of the relation R(ABCDEF) with FD's: AEF → C, BF → C, EF → D, and ACDE → F

This is a problem from my book. The book claims that the candidate keys are ABCDE and ABEF. From what I understand, a candidate key is the minimal superkey, and closure test on ABEF captures the relation R perfectly. Since ABEF is more "minimal" than ABCDE, I would argue the only candidate key is in fact, ABEF only. I will grant that ABCDE is a superkey, but not a candidate key. Can somebody explain why I am in the wrong here? Or is it possible that the book is wrong?


Solution

  • “Minimal superkey” does not mean the superkey with the minimum number of attributes of all the other (super)keys, but a (super)key such that, removing any attribute from it, loses the property of being a key, that is of determining all the attributes of the relation. For example, in your case,

    ABCDE+ = {ABCDEF}
    
    but:
    
    ABCD+ = ABCD
    ABCE+ = ABCE
    ABDE+ = ABDE
    ACDE+ = ACDEF
    BCDE+ = BCDE
    

    so no proper subset of ABCDE determines all the attributes, and for this reason it is a minimal superkey, that is a candidate key.