All Exams Test series for 1 year @ ₹349 only
Question

Consider R (A,B,C,D,E) be relation with following dependencies:
C- >F, E- > A, EC- >D, A- >B. Which of the following is a key for R?

The correct answer is
EC

Understanding Keys and Functional Dependencies in Relation R

The question asks us to identify a key for a relation R with attributes R(A,B,C,D,E) based on a given set of functional dependencies (FDs). Let's break down the concepts and analyze the options.

Key Concepts

  • Relation Attributes: The set of attributes for relation R is {A, B, C, D, E}.
  • Functional Dependencies (FDs): These define the relationships between attributes. The given FDs are:
    • $C \to F$
    • $E \to A$
    • $EC \to D$
    • $A \to B$
    Note: The FD $C \to F$ involves attribute F, which is not present in the relation R. Therefore, this specific dependency is not directly useful for determining keys within R. We focus only on attributes within R.
  • Key: A key is a set of one or more attributes that, taken collectively, uniquely identify tuples in a relation. A key must be a superkey (can determine all other attributes) and minimal (no proper subset is also a superkey). A minimal superkey is also known as a candidate key.
  • Attribute Closure ($X^+$): The attribute closure of a set of attributes X, denoted as $X^+$, is the set of all attributes that can be determined by X using the given FDs. We compute $X^+$ iteratively:
    1. Initialize the closure set with X.
    2. Repeatedly add attributes Y if there is an FD $W \to Y$ such that W is a subset of the current closure set.
    3. Continue until no more attributes can be added.

Determining the Key for Relation R

To find a key for R, we need to find a minimal set of attributes whose closure includes all attributes in R, i.e., {A, B, C, D, E}.

Analyzing Option 1: CD

Let's calculate the closure of CD, denoted as $(CD)^+$.

  • Initial set: $\{C, D\}$
  • Check FDs:
    • $C \to F$: F is not in R.
    • $E \to A$: Cannot apply (E is not in {C, D}).
    • $EC \to D$: Cannot apply (E is not in {C, D}).
    • $A \to B$: Cannot apply (A is not in {C, D}).
  • Result: $(CD)^+ = \{C, D\}$.

Since $(CD)^+$ does not contain all attributes of R ({A, B, C, D, E}), CD is not a key.

Analyzing Option 2: EC

Let's calculate the closure of EC, denoted as $(EC)^+$.

  • Initial set: $\{E, C\}$
  • Check FDs and update closure:
    • $E \to A$: Apply. Closure becomes $\{E, C, A\}$.
    • $A \to B$: Apply (since A is now in the closure). Closure becomes $\{E, C, A, B\}$.
    • $EC \to D$: Apply (since EC is the initial set and is in the closure). Closure becomes $\{E, C, A, B, D\}$.
    • $C \to F$: F is not in R.
  • Result: $(EC)^+ = \{A, B, C, D, E\}$.

The closure $(EC)^+$ contains all attributes of R. Now, we check if EC is minimal by examining its proper subsets:

  • Check $(E)^+$: Start with $\{E\}$. Using $E \to A$, we get $\{E, A\}$. Using $A \to B$, we get $\{E, A, B\}$. $(E)^+ = \{E, A, B\}$. This does not contain all attributes ({C, D} are missing).
  • Check $(C)^+$: Start with $\{C\}$. No FDs can be applied using C as the determinant within R. $(C)^+ = \{C\}$. This does not contain all attributes ({A, B, D, E} are missing).

Since neither (E)+ nor (C)+ contains all attributes, EC cannot be simplified further and is a minimal superkey. Therefore, EC is a candidate key for R.

Analyzing Option 3: AE

Let's calculate the closure of AE, denoted as $(AE)^+$.

  • Initial set: $\{A, E\}$
  • Check FDs:
    • $E \to A$: A is already present. Closure remains $\{A, E\}$.
    • $A \to B$: Apply. Closure becomes $\{A, E, B\}$.
    • $EC \to D$: Cannot apply (EC is not a subset of {A, E, B}).
  • Result: $(AE)^+ = \{A, B, E\}$.

Since $(AE)^+$ does not contain all attributes of R ({A, B, C, D, E}), AE is not a key.

Analyzing Option 4: AC

Let's calculate the closure of AC, denoted as $(AC)^+$.

  • Initial set: $\{A, C\}$
  • Check FDs:
    • $A \to B$: Apply. Closure becomes $\{A, C, B\}$.
    • $E \to A$: Cannot apply (E is not in {A, C, B}).
    • $EC \to D$: Cannot apply (EC is not a subset of {A, C, B}).
  • Result: $(AC)^+ = \{A, B, C\}$.

Since $(AC)^+$ does not contain all attributes of R ({A, B, C, D, E}), AC is not a key.

Conclusion

By calculating the attribute closures for each option, we found that only EC determines all the attributes of the relation R({A,B,C,D,E}). Furthermore, we confirmed that EC is minimal because its proper subsets (E and C individually) do not determine all attributes. Therefore, EC is a key (specifically, a candidate key) for the relation R.

Was this answer helpful?

Important Questions from Relational Model

  1. Given the relational schema $R = (U,V,W, X, Y, Z)$ and the set of functional dependencies: $$\{U \rightarrow V, U \rightarrow W, WX \rightarrow Y, WX \rightarrow Z, V \rightarrow X\}$$ Which of the following functional dependencies can be derived from the above set?

  2. The ‘12 Rules for Relational Database’ were given by
  3. Which of the following statement(s) is/are FALSE in the context of Relational DBMS ?
    I. Views in a database system are important because they help with access control by allowing users to see only a particular subset of the data in the database.
    II. E-R diagrams are useful to logically model concepts.
    III. An update anomaly is when it is not possible to store information unless some other, unrelated information is stored as well.
    IV. SQL is a procedural language.
  4. Let $R(A,B,C,D,E)$ be a relational schema with functional dependency set $F=\{A\rightarrow BC,\ CD\rightarrow E,\ E\rightarrow A\}$.

    Which of the following statements is correct?
  5. Consider the relation T1(A,B,C,D,E) with the dependencies {EB ->C,D ->E, EA ->B} and T2(A,B,C,D) with the dependencies {C->A,A->B, A->D}. Which of the following is TRUE?

Need Expert Advice?

Start Your Preparation with Prepp Mobile App

Download the app from Google Play & App Store
Download the app from Google Play & App Store
Prepp Mobile App