Question Details

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?

Options

A

6

B

7

C

9

D

3

Show Answer

Correct Answer :

Option A

6

Solution :

The correct answer is 6.

To find the number of distinct superkeys for the relation R(A,B,C,D), 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 R 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:


N ( A B A C ) = N ( A B ) + N ( A C ) - N ( A B A C )

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:

2 2 = 4
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:

2 2 = 4
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:

2 1 = 2
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:

Total Superkeys = 4 + 4 - 2 = 6

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}

Unlock Our Free Library

Access expert-curated educational resources and study materials—completely free.

Ask AI Tutor
5 left
Q1 View Question & Options
AI Tutor is solving this question...
Reading question context & options...