Consider a relation R(A, B, C, D). The candidate keys of the relation are AB and AC. How many distinct superkeys does the relation R have?
Correct Answer :
6
Solution :
The correct answer is 6.
To find the number of distinct superkeys for the relation , we need to understand the definitions of candidate keys and superkeys:
Candidate Key: A minimal set of attributes that uniquely identifies a tuple in a relation.
Superkey: A set of attributes that contains a candidate key as its subset. Any superset of a candidate key is a superkey.
The relation has the attributes: {A, B, C, D}.
The candidate keys are given as AB and AC.
We need to find the number of distinct subsets of {A, B, C, D} that contain either AB or AC. We can calculate this using the Principle of Inclusion-Exclusion:
Let's calculate each term step-by-step:
Step 1: Find the number of superkeys containing AB
Any superkey containing AB must have the attributes A and B. The remaining attributes {C, D} can either be included or excluded from the superkey. Since there are 2 remaining attributes, the number of possible combinations is:
These 4 superkeys are: {A, B}, {A, B, C}, {A, B, D}, and {A, B, C, D}.
Step 2: Find the number of superkeys containing AC
Any superkey containing AC must have the attributes A and C. The remaining attributes {B, D} can either be included or excluded. The number of possible combinations is:
These 4 superkeys are: {A, C}, {A, B, C}, {A, C, D}, and {A, B, C, D}.
Step 3: Find the number of superkeys containing both AB and AC (Intersection)
A superkey contains both AB and AC if and only if it contains their union, ABC. The only remaining attribute is {D}, which can either be included or excluded. The number of combinations is:
These 2 superkeys are: {A, B, C} and {A, B, C, D}.
Step 4: Apply the Principle of Inclusion-Exclusion
Using the values calculated above:
Thus, the 6 distinct superkeys of the relation R are:
1. {A, B}
2. {A, C}
3. {A, B, C}
4. {A, B, D}
5. {A, C, D}
6. {A, B, C, D}
Access expert-curated educational resources and study materials—completely free.
Create, conduct, and manage professional online assessments with Mindyard. Perfect for teachers and institutes.
Copyright © 2026 Mindyard. All Rights Reserved.