Consider a relational database schema with a relation π (π΄,π΅,πΆ,π·). Ifβ¦
2026
Consider a relational database schema with a relation π (π΄,π΅,πΆ,π·). If {π΄,π΅} and {π΄,πΆ} are the only two candidate keys of the relation π , then the number of superkeys of relation π is ______. (answer in integer)
Attempted by 30 students.
Show answer & explanation
Correct answer: 6
A superkey is any set of attributes that contains at least one candidate key. The relation R has attributes {A, B, C, D}.
Candidate keys are {A, B} and {A, C}. Superkeys containing {A, B} are formed by adding any subset of remaining attributes {C, D}.
There are 2^2 = 4 such superkeys: {A, B}, {A, B, C}, {A, B, D}, {A, B, C, D}.
Similarly, superkeys containing {A, C} are formed by adding any subset of remaining attributes {B, D}. There are 2^2 = 4 such superkeys.
The intersection contains superkeys with both {A, B} and {A, C}, which means {A, B, C} plus subsets of {D}. There are 2^1 = 2 such superkeys.
Total superkeys = (Superkeys with {A, B}) + (Superkeys with {A, C}) - (Intersection) = 4 + 4 - 2 = 6.
Answer: 6