Canonical Cover in DBMS
Canonical Cover in DBMS
In this article, we will learn about Canonical Cover i DBMS. The canonical cover
is defined as a simplified and reduced version of a given functional dependency. As Canonical cover is a compressed version is also called an irreducible set.
Features of Canonical cover
- The canonical cover is free from all irrelevant functional dependencies
- The closure of canonical cover is the same as that of a given set of functional dependency
- The canonical cover is not unique because there may be more than one chemical cover for a given set of functional dependency.
What’s the need for this Canonical cover
Reduces computational time: When a functional dependency is free from useless dependency e then computational time and working with that set becomes very easy.
PRACTICE PROBLEM BASED ON FINDING CANONICAL COVER-
You will be given some 3 to 5 functional dependencies and asked to find the simplified version that is Canonical cover
Change WXYZ to ABCD
Problem :
The following functional dependencies hold true for the relational scheme R (W, X, Y, Z) –
X → W
WZ → XY
Y → WXZ
Write the irreducible equivalent for the given set of functional dependencies.
Solution-
STEP 1: Write all the functional dependencies such that each dependency contains only one attribute on its right side i.e-
X → W
WZ → X
WZ → Y
Y → W
Y → X
Y → Z
STEP 2: Check each functional dependency one by one whether it is essential or not
- For X → W:
Including X → W, (X) + = {X, W}
Ignoring X → W, (X) + = {X}
Now, as the the two results are different, it is concluded that X→W is essential and cannot be eliminated.
- For WZ → X:
Including WZ → X, (WZ) + = {W, X, Y, Z}
Ignoring WZ → X, (WZ) + = {W, X, Y, Z}
Now, as the the two results are same, it is concluded that WZ→X is not essential and can be eliminated.
After eliminating WZ→X ,the resultant set of functional dependencies is :
X → W
WZ → Y
Y → W
Y → X
Y → Z
Now, we will consider this reduced set in further checks.
- For WZ → Y:
Including WZ → Y, (WZ) + = {W, X, Y, Z}
Ignoring WZ → Y, (WZ) + = {W, Z}
Now, as the the two results are different, it is concluded that WZ→Y is essential and cannot be eliminated.
- For Y → W:
Including Y → W, (Y) + = {W, X, Y, Z}
Ignoring Y → W, (Y) + = {W, X, Y, Z}
Now, as the the two results are same, it is concluded that Y→W is not essential and can be eliminated.
After eliminating Y→W,the resultant set of functional dependencies is :
X → W
WZ → Y
Y → X
Y → Z
- For Y → X:
Including Y → X, (Y) + = {W, X, Y, Z}
Ignoring Y → X, (Y) + = {Y, Z}
Now, as the the two results are different, it is concluded that Y→X is essential and cannot be eliminated.
- For Y → Z:
Including Y → Z, (Y) + = {W, X, Y, Z}
Ignoring Y → Z, (Y) + = {W, X, Y}
Now, as the the two results are different, it is concluded that Y→Z is essential and cannot be eliminated.
- From here, our essential functional dependencies are-
X → W
WZ → Y
Y → X
Y → Z
Prime Course Trailer
Related Banners
Get PrepInsta Prime & get Access to all 200+ courses offered by PrepInsta in One Subscription
Get over 200+ course One Subscription
Courses like AI/ML, Cloud Computing, Ethical Hacking, C, C++, Java, Python, DSA (All Languages), Competitive Coding (All Languages), TCS, Infosys, Wipro, Amazon, DBMS, SQL and others
Login/Signup to comment