• edited by
3,440 views

5 Answers

6 6 votes

To find the number of superkeys for the relation $R(A, B, C, D)$ with candidate keys $\{A, B\}$ and $\{A, C\}$, we use the Principle of Inclusion-Exclusion.

1. Basic Concepts

  • Relation $R$: Contains 4 attributes $\{A, B, C, D\}$. Thus, $n = 4$.

  • Candidate Key (CK): A minimal set of attributes that uniquely identifies a tuple. Any superset of a candidate key is a superkey.

  • Formula: If a candidate key has $k$ attributes, the number of its superkeys in a relation with $n$ attributes is $2^{n-k}$.


2. Calculation Steps

Let:

  • $S_1$ be the set of superkeys containing $\{A, B\}$.

  • $S_2$ be the set of superkeys containing $\{A, C\}$.

Step 1: Superkeys containing $\{A, B\}$

The candidate key $\{A, B\}$ has 2 attributes. The remaining attributes are $\{C, D\}$ (2 attributes).

The number of superkeys is:

$$|S_1| = 2^{4-2} = 2^2 = 4$$

(These are $\{AB\}, \{ABC\}, \{ABD\}, \{ABCD\}$)

Step 2: Superkeys containing $\{A, C\}$

The candidate key $\{A, C\}$ has 2 attributes. The remaining attributes are $\{B, D\}$ (2 attributes).

The number of superkeys is:

$$|S_2| = 2^{4-2} = 2^2 = 4$$

(These are $\{AC\}, \{ACB\}, \{ACD\}, \{ACBD\}$)

Step 3: Common Superkeys

These are superkeys that contain both candidate keys $\{A, B\}$ and $\{A, C\}$.

This is equivalent to superkeys containing the union $\{A, B\} \cup \{A, C\} = \{A, B, C\}$.

The union $\{A, B, C\}$ has 3 attributes. The remaining attribute is $\{D\}$.

The number of common superkeys is:

$$|S_1 \cap S_2| = 2^{4-3} = 2^1 = 2$$

(These are $\{ABC\}$ and $\{ABCD\}$)


3. Final Answer

Using the Principle of Inclusion-Exclusion:

$$\text{Total Superkeys} = |S_1| + |S_2| - |S_1 \cap S_2|$$

$$\text{Total Superkeys} = 4 + 4 - 2 = 6$$

The number of superkeys of relation $R$ is 6.

 

 

4 4 votes
The number of superkeys containing candidate key AB = 2² = 4

The number of superkeys containing candidate key AC = 2² = 4

Number of common super keys which contains both candidate key = 2

Total number of superkeys are = superkeys keys from ck AB + superkeys from CK AC - common superkeys from CK (AC and AB)

                                                       = 4+4-2=6
4 4 votes

Given:-

R(A, B, C, D) 

Candidate Key = {A, B}, {A, C}

To Find :- Total No. of Super Key

Solution:-

Super Key = {AB, AC, ABC, ABD, ACD, ABCD}

Therefore, Total no. of Super Keys = 6

• edited by
Answer:
Position:
Show:

Related questions

2 2 votes
3 3 answers
4.3k
4.3k views
Arjun asked Dec 7, 2018
4,301 views
Maximum number of superkeys for the relation schema $R(X,Y,Z,W)$ with $X$ as the key is$6$$8$$9$$12$
4 4 votes
1 1 answer
201
201 views
GO Classes asked Sep 2
201 views
A relation schema $R$ has $6$ attributes.Assume that the empty set is not considered a key.What is the maximum possible number of superkeys of $R$?
5 5 votes
4 4 answers
1.7k
1.7k views
gatecse asked Feb 23
1,732 views
Consider a relational database schema with two relations $R(P, Q)$ and $S(X, Y)$.Let $E=\{\langle u\rangle \mid \exists v \exists w\langle u, v\rangle \in R \wedge\langle...
16 16 votes
4 4 answers
2.6k
2.6k views
gatecse asked Feb 23
2,550 views
Let $P, Q, R$ and $S$ be the attributes of a relation in a relational schema. Let $X \rightarrow Y$ indicate functional dependency in the context of a relational database...