GATE / CS ARCHIVE

GATE CSE 2026 SET 1 / QUESTION 65

Counting superkeys by inclusion-exclusion

Database Management Systems · Functional Dependencies & Keys · Full GATE CSE 2026 Set 1 paper

GATE 2026 Set 1, Q65 2 marks · NAT
Report issue

Functional Dependencies & Keys

Question 65, GATE 2026: R has four attributes A,B,C,D. Its only candidate keys are {A,B} and {A,C}. Count all superkeys.
Tap to enlarge
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.

Original paper, page 46 · Answer key