closure properties
closure properties
Topic:Closure properties
NISHA C.D,Assistant professor
Department of Computer Science
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
Now, let us find the closure of some attributes and attribute sets-
Closure of attribute A-
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 the result set.
Thus,
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-
AB → CD
AF → D
DE → F
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-
We can determine the candidate keys of a given relation using the following steps-
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.
If all essential attributes together can determine all remaining non-essential attributes, then-
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
Also, determine the total number of candidate keys and super keys.
Step-01:
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 )
We conclude that CE can determine all the attributes of the given relation.
So, CE is the only possible candidate key of the relation.