Functional Dependency
Functional Dependency
Step-01:
• Determine all essential attributes of the given
relation.
• Essential attributes are those attributes which are
not present on RHS of any functional dependency.
• Essential attributes are always a part of every
candidate key.
• This is because they can not be determined by
other attributes.
PRACTICE PROBLEMS BASED ON FINDING CANDIDATE KEYS-
Problem-01:
Let R = (A, B, C, D, E, F) be a relation scheme with the following
dependencies-
C→F
E→A
EC → D
A→B
Which of the following is a key for R?
CD
EC
AE
AC
Also, determine the total number of candidate keys and super keys.
Solution-
Step-01:
We conclude that CE can determine all the attributes of the given relation.
So, CE is the only possible candidate key of the relation.
Thus, Option (B) is correct.
Total Number of Candidate Keys-
We will find candidate keys of the given relation in the following steps-
Step-01:
Step-02:
Now,
We will check if the essential attributes together can determine all remaining non
essential attributes.
To check, we find the closure of AB.
So, we have-
{ AB }+
={A,B}
= { A , B , C } ( Using AB → C )
= { A , B , C , D } ( Using C → D )
= { A , B , C , D , E } ( Using B → E )
We conclude that AB can determine all the attributes of the given relation.
Thus, AB is the only possible candidate key of the relation.
Also, determine the total number of candidate keys and super keys.
Solution-
We will find candidate keys of the given relation in the following steps-
Step-01:
Step-02:
Now,
We will check if the essential attributes together can determine all remaining non-essential attributes.
To check, we find the closure of EFH.
So, we have-
{ EFH }+
={E,F,H}
= { E , F , G , H } ( Using EF → G )
= { E , F , G , H , I , J } ( Using F → IJ )
= { E , F , G , H , I , J , K , L } ( Using EH → KL )
= { E , F , G , H , I , J , K , L , M } ( Using K → M )
= { E , F , G , H , I , J , K , L , M , N } ( Using L → N )
We conclude that EFH can determine all the attributes of the given relation.
So, EFH is the only possible candidate key of the relation.
Total Number of Candidate Keys-