Functional Dependency Theory
Functional Dependency Theory
SYSTEM
Dr. Mageshwari V
Assistant Professor
Department of Mathematics
Amrita Vishwa Vidyapeetham
Closure of an Attribute Set-
Closure of an Attribute Set-
● The set of all those attributes which can be functionally determined from an attribute set is called as
a closure of that attribute set.
● Closure of attribute set {X} is denoted as {X}+.
Steps to Find Closure of an Attribute Set-
Step-01:
Add the attributes contained in the attribute set for which closure is being calculated to
the result set.
Step-02:
Recursively add the attributes to the result set which can be functionally determined from the attributes
already contained in the result set.
Example-
A → BC
BC → DE
D→F
CF → G
A+ = { A }
= { A , B , C } ( Using A → BC )
= { A , B , C , D , E } ( Using BC → DE )
= { A , B , C , D , E , F } ( Using D → F )
= { A , B , C , D , E , F , G } ( Using CF → G )
Thus,
A+ = { A , B , C , D , E , F , G }
Closure of attribute D-
D+ = { D }
= { D , F } ( Using D → F )
We can not determine any other attribute using attributes D and F contained in
D+ = { D , F }
Closure of attribute set {B, C}-
{ B , C }+= { B , C }
= { B , C , D , E } ( Using BC → DE )
= { B , C , D , E , F } ( Using D → F )
= { B , C , D , E , F , G } ( Using CF → G )
Thus,
{ B , C }+ = { B , C , D , E , F , G }
Finding the Keys Using Closure-
Super Key-
● If the closure result of an attribute set contains all the attributes of the relation, then that attribute set is
called as a super key of that relation.
● Thus, we can say-
Candidate Key-
● If there exists no subset of an attribute set whose closure contains all the attributes of the relation, then
that attribute set is called as a candidate key of that relation.
Example-
AF → D
DE →
C →G
F→E
G →
A
Solution-
Option-(A):
{ CF }+ = { C , F }
= { C , F , G } ( Using C → G )
= { C , E , F , G } ( Using F → E )
= { A , C , E , E , F } ( Using G → A )
= { A , C , D , E , F , G } ( Using AF
→D)
Candidate Key-
A set of minimal attribute(s) that can identify each tuple uniquely in the given relation is called as a
candidate key.
OR
These are candidate keys because each set consists of minimal attributes required to identify each student
uniquely in the Student table.
Finding Candidate Keys-
Step-01:
A→B
C →
D D
→E
Here, the attributes which are not present on RHS of any functional dependency are
A, C and F.
Case-02:
If all essential attributes together can not determine all remaining non-essential attributes, then-
● The set of essential attributes and some non-essential attributes will be the candidate
key(s).
● In this case, multiple candidate keys are possible.
● To find the candidate keys, we check different combinations of essential and non-
essential attributes.
Let R = (A, B, C, D, E, F) be a relation scheme with the following
dependencies-
C → F
E → A
EC → D
A→B
1. CD
2. EC
3. AE
4. AC
So, we have-
{ CE }+
={C,E}
= { C , E , F } ( Using C → F )
= { A , C , E , F } ( Using E → A )
= { A , C , D , E , F } ( Using EC → D )
= { A , B , C , D , E , F } ( Using A → B )