GATE / CS ARCHIVE

SIMILAR QUESTIONS / DATABASE MANAGEMENT SYSTEMS

Count supersets of candidate keys

3 questions solved the same way, newest first. Back to Database Management Systems

How these are solved

First establish candidate keys by closure, then count their attribute supersets and subtract overlaps. A superkey need not be minimal.

2 marks · NAT
Report issue

Counting superkeys by inclusion-exclusion

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

1 mark · NAT
Report issue

Functional Dependencies & Keys

Question 31, GATE 2022: For R(A,B,C,D,E), dependencies are AB→C, BC→D, C→E. How many superkeys exist?
Tap to enlarge
Answer & solution

Official answer: 8

Step through it (3 steps)

A and B never appear on a dependency’s right side, so every key and superkey must include both. AB determines C, then BC determines D, and C determines E; hence AB is a key. All superkeys are AB with any subset of {C, D, E}, giving 2³=8.

Compute (AB)+: begin {A,B}; AB→C adds C; BC→D adds D; C→E adds E. No set lacking A or B can obtain it from these FDs, proving AB is the unique minimal key. The eight superkeys are AB,ABC,ABD,ABE,ABCD,ABCE,ABDE,ABCDE.

Original paper, page 22 · Answer key

1 mark · NAT
Report issue

Functional Dependencies & Keys

Question 21, GATE 2014: For relation schema R(E,F,G,H), with E as the key, find the maximum number of superkeys.
Tap to enlarge
Answer & solution

Official answer: 8

Our answer: 8 if E is the sole candidate key

1. Set up the reasoning. A superkey uniquely identifies tuples and may contain redundant attributes. Starting from E, independently include or omit each of the three remaining attributes F, G, and H.

2. Derive the result. Every superset of E is a superkey; choosing any subset of F, G, H gives 2³=8. Reading E as the only candidate key gives exactly this count. If it merely says E is one candidate key, additional keys could increase the count, up to all 15 nonempty attribute subsets when every singleton is a key. Thus the official 8 relies on the sole-key reading of the key.

3. Check the interpretation. The intended count treats E as the sole candidate key: E, EF, EG, EH, EFG, EFH, EGH, EFGH. If the phrase only grants that E is one key, other candidate keys are not ruled out; preserve that ambiguity rather than claiming eight follows unconditionally.

Original paper, page 33 · Answer key