Similar questions 2 more →
Functional Dependencies & Keys

Answer & solution
Official answer: 6
Givens and goal
R has four attributes A,B,C,D. Its only candidate keys are {A,B} and {A,C}. Count all superkeys.
Approach
Every superset of a candidate key is a superkey; count both superset families and subtract their overlap.
Step-by-step solution
1. A candidate key is a minimal superkey. Adding attributes preserves the ability to identify a tuple, so every set containing AB or AC is a superkey.
2. For AB, the remaining attributes C and D may each be included or omitted independently, giving 2²=4 supersets: AB,ABC,ABD,ABCD.
3. For AC, optional attributes B and D similarly give AC,ABC,ACD,ABCD, again four.
4. A set counted in both families must contain AB∪AC=ABC. Its only optional attribute is D, so the overlap is {ABC,ABCD}, of size 2.
5. Inclusion-exclusion gives 4+4−2=6. The six distinct superkeys are AB,AC,ABC,ABD,ACD,ABCD.
6. There are no others: from any superkey one can repeatedly remove unnecessary attributes until a minimal superkey, hence a candidate key, remains. The premise says the only such minima are AB and AC, so every superkey must contain at least one of them. D need not belong to a candidate key to occur in larger superkeys.