Skip to content
Official PYQ · 2026

GATE CS 2026 Set 1 Q55 — ER-model

Explain with AI
Consider a relational database schema with a relation R(A,B,C,D)R(A, B, C, D). If {A,B}\{A, B\} and {A,C}\{A, C\} are the only two candidate keys of the relation RR, then the number of superkeys of relation RR is ____\_\_\_\_.  (answer in integer)
View worked solution

Answer: 6 : 6

A superkey of a relation is any set of attributes that contains a candidate key as a subset.

Given the relation schema R(A,B,C,D)R(A, B, C, D) with the set of all attributes U={A,B,C,D}U = \{A, B, C, D\}, the candidate keys are:

  • K1={A,B}K_1 = \{A, B\}
  • K2={A,C}K_2 = \{A, C\}

We can find the total number of superkeys using the Principle of Inclusion-Exclusion:

Total Superkeys=∣Supersets of K1∣+∣Supersets of K2∣−∣Supersets of both K1 and K2∣\text{Total Superkeys} = |\text{Supersets of } K_1| + |\text{Supersets of } K_2| - |\text{Supersets of both } K_1 \text{ and } K_2|

  1. Supersets of K1={A,B}K_1 = \{A, B\}:
    The remaining attributes are U∖{A,B}={C,D}U \setminus \{A, B\} = \{C, D\}.
    Number of supersets =24−2=22=4= 2^{4-2} = 2^2 = 4.
    These are: {A,B}\{A, B\}, {A,B,C}\{A, B, C\}, {A,B,D}\{A, B, D\}, and {A,B,C,D}\{A, B, C, D\}.

  2. Supersets of K2={A,C}K_2 = \{A, C\}:
    The remaining attributes are U∖{A,C}={B,D}U \setminus \{A, C\} = \{B, D\}.
    Number of supersets =24−2=22=4= 2^{4-2} = 2^2 = 4.
    These are: {A,C}\{A, C\}, {A,B,C}\{A, B, C\}, {A,C,D}\{A, C, D\}, and {A,B,C,D}\{A, B, C, D\}.

  3. Supersets of both K1K_1 and K2K_2:
    A set containing both K1K_1 and K2K_2 must contain K1∪K2={A,B,C}K_1 \cup K_2 = \{A, B, C\}.
    The remaining attribute is U∖{A,B,C}={D}U \setminus \{A, B, C\} = \{D\}.
    Number of such supersets =24−3=21=2= 2^{4-3} = 2^1 = 2.
    These are: {A,B,C}\{A, B, C\} and {A,B,C,D}\{A, B, C, D\}.

Applying the formula:

Total Superkeys=4+4−2=6\text{Total Superkeys} = 4 + 4 - 2 = 6

The 66 unique superkeys are:

  1. {A,B}\{A, B\}
  2. {A,C}\{A, C\}
  3. {A,B,C}\{A, B, C\}
  4. {A,B,D}\{A, B, D\}
  5. {A,C,D}\{A, C, D\}
  6. {A,B,C,D}\{A, B, C, D\}

Free practice · Your answers on this page are not saved.

Published
Report a correction
Keep exploringMore ER-model questions