Computer Sciences > GATE 2026 SET-1 > Keys and Constraints
Consider a relational database schema with a relation R(A, B, C, D). If {A, B} and {A, C} are the only two candidate keys of the relation R, then the number of superkeys of relation R is ______. (answer in integer)

Correct : 6

To find the total number of superkeys for the relation R(A, B, C, D), we need to use the properties of candidate keys and apply the mathematical principle of inclusion-exclusion.
1. Identify the Given Variables
The relation R has 4 total attributes: n = 4 (A, B, C, D).
Candidate Key 1 (CK1) = {A, B}
Candidate Key 2 (CK2) = {A, C}
2. Calculate Superkeys from CK1
A superkey is any superset of a candidate key. To find the superkeys generated by {A, B}, we can append any combination of the remaining attributes, which are {C, D}.
There are 4 - 2 = 2 remaining attributes.
The number of superkeys generated by CK1 is 22 = 4.
(These are: {A, B}, {A, B, C}, {A, B, D}, {A, B, C, D})
3. Calculate Superkeys from CK2
Similarly, to find the superkeys generated by {A, C}, we can append any combination of its remaining attributes, which are {B, D}.
There are 4 - 2 = 2 remaining attributes.
The number of superkeys generated by CK2 is 22 = 4.
(These are: {A, C}, {A, B, C}, {A, C, D}, {A, B, C, D})
4. Subtract the Common Superkeys (Intersection)
If we simply add 4 + 4, we will double-count the superkeys that contain both {A, B} and {A, C}. We must subtract this intersection.
The union of the two candidate keys is {A, B} ∪ {A, C} = {A, B, C}.
The remaining attributes not in this union: 4 - 3 = 1 attribute (which is {D}).
The number of common superkeys is 21 = 2.
(These are exactly {A, B, C} and {A, B, C, D})
5. Final Calculation
Total Superkeys = Superkeys(CK1) + Superkeys(CK2) - Common Superkeys
Total Superkeys = 4 + 4 - 2 = 6.
Correct Answer: 6

Similar Questions

A palindrome is a word that reads the same forwards and backwards. In a game of words, a player has the following two plates painted with letters. From...
#1 MCQ
Which number does not belong in the series below? 2, 5, 10, 17, 26, 37, 50, 64
#4 MCQ
Choose the word that is opposite in meaning to the word “coherent”.
#5 MCQ

Related Topics

calculate superkeys DBMS relational database schema keys candidate keys superkeys formula DBMS GATE questions GATE CS database management inclusion exclusion principle DBMS superkey calculation example relation R(A B C D) superkey intersection DBMS

Unique Visitor Count

Total Unique Visitors

Loading......