GATE 2022 CS – Question 31
Consider a relation $R(A,B,C,D,E)$ with the following three functional dependencies.
$AB\to C$; $BC\to D$; $C\to E$;
The number of superkeys in the relation R is _____________.
Practise this question in The GATE Grind →
Show answer and explanation
Correct answer: 8
Explanation
$R(A,B,C,D,E)$ with $AB\to C$, $BC\to D$, $C\to E$.
The attributes $A$ and $B$ never appear on a right-hand side, so they are in **every** key. Compute $(AB)^+$:
- $AB\to C$ adds $C$;
- $BC\to D$ adds $D$;
- $C\to E$ adds $E$.
So $(AB)^+=ABCDE$ and $AB$ is the only candidate key.
A superkey is any set containing a candidate key, i.e. any subset that contains both $A$ and $B$. The other three attributes $C,D,E$ can each be present or absent: $2^3=\mathbf8$ superkeys.