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

Explore the full course: Gate Guidance By Sanchit Sir