DBMS Assignment 2
DBMS Assignment 2
Answer:-
Step 1: Identify Closure of Attributes
To find the candidate key, we check which set of attributes can determine all attributes of R(A, B, C, D).
Given FDs:
o B→C
o D→A
Now, let's check attribute closures:
Closure of BD:
1. BD → {B, D} (Trivial)
2. Since B → C, we get {B, D, C}
3. Since D → A, we get {B, D, C, A}
→ BD+ = {A, B, C, D} (Covers all attributes)
Candidate Key = BD
Step 2: Check for Minimality
B alone doesn't cover all attributes.
D alone doesn't cover all attributes.
BD is minimal (removing either B or D loses full coverage).
Thus, BD is the only candidate key.
Q8. Suppose that you are given a relation R = (A, B, C, D, E) with the following functional dependencies:
{BC → ADE, D → B}. Find all candidate keys.
Answer:-
Step 1: Identify Closure of Attributes
To find the candidate key, we check which set of attributes can determine all attributes of R(A, B, C, D, E).
Given Functional Dependencies (FDs):
BC→ADE
D→B
Now, let's check the closure of different attribute sets:
Closure of {B, C}:
1. BC→ADE, so we get {A, B, C, D, E}.
2. Since BB and CC together give us all the attributes, we have:
o {B, C} += {A, B, C, D, E} (Covers all attributes).
→ Candidate Key: {B, C}.
Closure of {D, C}:
1. D→B, so we get {D, C, B}.
2. Since BC→ADE, we get {A, B, C, D, E}.
3. All attributes are covered:
o {D, C} += {A, B, C, D, E} (Covers all attributes).
→ Candidate Key: {D, C}.
Closure of {D, B}:
1. D→B, but we already have B in the set.
2. Since we don't have C, we can't apply BC→ADE to determine A or E.
3. So, {D, B} += {B, D}, which does not cover all attributes.
→ {D, B} is not a candidate key.
Closure of {B, D}:
1. Similar to {D, B}, we already know B and D won't cover C, so the closure doesn’t cover all
attributes.
2. {B, D} += {B, D}, which does not cover all attributes.
→ {B, D} is not a candidate key.
Step 2: Check for Minimality
{B, C} covers all attributes, and removing either B or C will result in an incomplete set (i.e., no
coverage of all attributes).
{D, C} also covers all attributes, and removing either D or C will result in an incomplete set as well.
Thus, both {B, C} and {D, C} are minimal candidate keys.
Both are minimal, meaning no attributes can be removed without losing the ability to uniquely identify all
the attributes in the relation.