Question:medium

Consider the relation \( R(A, B, C, D, E) \)
Functional Dependencies:
\[ A \rightarrow BC \] \[ CD \rightarrow E \] \[ E \rightarrow A \] Find the number of candidate keys.

Show Hint

If an attribute never appears on the right-hand side of any functional dependency, it must be part of every candidate key.
Updated On: Feb 15, 2026
Show Solution

Correct Answer: 2

Solution and Explanation

Step 1: Understanding the Topic
This question is about finding candidate keys for a database relation. A candidate key is a minimal set of attributes that can uniquely identify every record in a table. To find them, we use the given functional dependencies (FDs) to see which attribute sets can determine all other attributes in the relation.
Step 2: Key Approach - Attribute Closure
The primary method is to calculate the attribute closure of a set of attributes, denoted as $\{X\}^+$. This is the set of all attributes that can be determined by the set $X$. A set $X$ is a candidate key if its closure contains all attributes of the relation ($A, B, C, D, E$) and no proper subset of $X$ has this property (minimality).
A good starting point is to identify attributes that are never on the right-hand side (RHS) of any FD. Such attributes must be part of every candidate key. Here, the attribute D never appears on the RHS, so D must be in every candidate key.
Step 3: Detailed Calculation
We must find minimal attribute sets containing D whose closure is the entire set $\{A,B,C,D,E\}$.
A. Test the attribute set {A, D:}
The closure of {A, D}, denoted $\{A, D\}^+$, is calculated as follows:

Start with $\{A, D\}$.
From the FD $A \rightarrow BC$, we can add B and C. The set becomes $\{A, B, C, D\}$.
Now that we have both C and D, we can use the FD $CD \rightarrow E$. We add E.
The final closure is $\{A, B, C, D, E\}$, which includes all attributes.
Since {A, D} determines all other attributes and is minimal (neither {A} nor {D} alone is sufficient), AD is a candidate key.
B. Test the attribute set {E, D:}
The closure of {E, D}, denoted $\{E, D\}^+$, is calculated as follows:

Start with $\{E, D\}$.
From the FD $E \rightarrow A$, we can add A. The set becomes $\{E, D, A\}$.
Now that we have A, we can use the FD $A \rightarrow BC$. We add B and C.
The final closure is $\{A, B, C, D, E\}$, which includes all attributes.
Since {E, D} determines all other attributes and is minimal, ED is a candidate key.
Step 4: Final Answer
Following this analysis, we have identified two distinct candidate keys: AD and ED. \[ \boxed{2} \]
Was this answer helpful?
0