20.6 KB Β· commit 40bb182
β Previous: T08.4: Attribute Closure and Finding Candidate Keys | π Index | Next: T08.6: Normal Forms β
Topic: T08 β Normalization & Functional Dependencies | Priority: π’ | Exam Frequency: 1/7 finals (8 marks total: 2021 Q6a [3m] + 2021 Q6b [5m]) Sources: Silberschatz 7e Ch. 7 (Β§7.4.3, pp. 324β328) Β· Lecture Deck 06 (Slide 4, Slide 14)
Whenever a row is inserted or updated, the database engine has to check that no functional dependencies are broken. If your list of functional dependencies contains redundant rules or extra attributes, the database wastes time checking the same things over and over. A canonical cover (Fcβ) cleans up a functional dependency set into its smallest, simplest equivalent version without losing any rules. It is also the required first step for the 3NF synthesis algorithm, and RUET tested it for a full 8 marks on the 2021 semester final.
Functional Dependency: A functional dependency Ξ±βΞ² on relation schema R is a constraint stating that any two rows with the same value for Ξ± must also have the same value for Ξ² (t1β[Ξ±]=t2β[Ξ±]βΉt1β[Ξ²]=t2β[Ξ²]).
Extraneous Attribute: An attribute in a functional dependency Ξ±βΞ² is extraneous if we can remove it without changing the closure F+ of the dependency set. On the left side, AβΞ± is extraneous if (Ξ±β{A})βΞ² already holds in F. On the right side, AβΞ² is extraneous if Ξ±βA still holds after removing A from Ξ².
Canonical Cover (Fcβ): A canonical cover Fcβ is a minimal, simplified set of functional dependencies that is logically equivalent to F (Fc+β=F+). It satisfies two strict rules:
- No functional dependency in Fcβ contains an extraneous attribute on either side.
- Each left-hand side of a functional dependency in Fcβ is unique.
An attribute inside a functional dependency is called extraneous if you can cross it out without changing the overall closure F+ of the rule set. Because crossing out an attribute on the left side does the opposite of crossing out an attribute on the right side, we test them in two slightly different ways.
Why the LHS rule works: Think about what happens when you drop B from ABβC to get AβC. The new rule AβC is actually a stronger statement (it says A alone is enough to determine C, without needing B's help). Because AβC automatically implies the old ABβC by augmentation, the only thing we have to check is whether the rest of our rules already imply the stronger statement AβC (or whether A alone already determines B).
Formal Test for LHS:
Suppose AβΞ± in the dependency Ξ±βΞ². To test if A is extraneous on the left:
Why the RHS rule works: Now think about dropping C from the right side of ABβCD to leave ABβD. That makes the rule weaker, because we are throwing away the claim that ABβC. To make sure we haven't lost ABβC forever, we temporarily hide C from that rule and check whether the remaining dependencies in our set can still derive ABβC on their own.
Formal Test for RHS:
Suppose AβΞ² in the dependency Ξ±βΞ². To test if A is extraneous on the right:
Fc := F;
repeat
Use the union rule to replace any dependencies in Fc
of the form alpha1 -> beta1 and alpha1 -> beta2 with alpha1 -> beta1 beta2;
Find a functional dependency alpha -> beta in Fc with an extraneous
attribute either in alpha or in beta;
/* Note: the test for extraneous attributes is done using Fc, not F */
if an extraneous attribute is found then
delete it from alpha -> beta in Fc;
until (Fc does not change);
Figure 1: Procedure to compute canonical cover Fcβ for a set of functional dependencies F (Silberschatz 7e, Figure 7.9).
A common exam question asks to differentiate between normalization and canonical cover. The two concepts operate at different stages of database design:
| Feature / Parameter | Normalization | Canonical Cover (Fcβ) |
|---|---|---|
| Core Definition | The process of decomposing relation schemas to eliminate redundancy and update anomalies. | A minimal, non-redundant set of functional dependencies logically equivalent to the original set. |
| Primary Goal | Design high-integrity tables free of insertion, deletion, and update anomalies. | Simplify integrity constraints so that updates can be checked with minimal computational overhead. |
| Input Data | A relation schema R along with its functional dependency set F. | A functional dependency set F. |
| Output Data | A set of decomposed relation schemas {R1β,R2β,β¦,Rkβ} meeting a target normal form (3NF, BCNF). | A simplified functional dependency set Fcβ with unique LHS and zero extraneous attributes. |
| Level of Operation | Schema design level (modifying table structures, columns, and foreign keys). | Mathematical constraint level (optimizing logical implications between attributes). |
| Relationship | Uses canonical cover as an intermediate step (e.g., in the 3NF synthesis algorithm). | Acts as a preparatory optimization step before schema synthesis and decomposition. |
Let R(A,B,C) with the functional dependency set:
F={AβBC,BβC,AβB,ABβC}Dependencies AβBC and AβB have the same left-hand side (A). Combine them using the union rule:
Fcβ={AβBC,BβC,ABβC}Consider dependency ABβC. The LHS contains two attributes: A and B.
Consider dependency AβBC. The RHS contains two attributes: B and C.
The resulting set has unique left-hand sides and no extraneous attributes:
Fcβ={AβB,BβC}| Year & Question | Marks | Scenario / Data Given | Key Result / Answer Summary |
|---|---|---|---|
| 2021 Q.6(a) | 3 | Differentiate between normalization and canonical cover in DBMS | Structured 5-point comparison table (schema level vs. constraint level) |
| 2021 Q.6(b) | 5 | Formal definition of FD + find canonical form for F={AβBC,CDβE,BβD,EβA} | Formal tuple definition; all 4 FDs retain their form because no extraneous attributes exist |
Appeared: 2021 Q.6(a) β (03 Marks, Section B, CLO1)
Question:
Differentiate between normalization and canonical cover in DBMS.
Full Answer:
| Parameter | Normalization | Canonical Cover (Fcβ) |
|---|---|---|
| Definition | The systematic decomposition of a relation schema into smaller schemas to eliminate anomalies and reduce data redundancy. | A minimal, non-redundant set of functional dependencies logically equivalent to the original functional dependency set. |
| Primary Goal | To design well-structured tables free of insertion, deletion, and update anomalies. | To simplify database integrity constraints so that runtime modification checks execute with minimal overhead. |
| Input | A relation schema R and a functional dependency set F. | A functional dependency set F. |
| Output | A collection of decomposed relations {R1β,R2β,β¦,Rkβ} in a desired normal form (such as 3NF or BCNF). | A simplified functional dependency set Fcβ with unique left-hand sides and zero extraneous attributes. |
| Operational Level | Operates at the relational schema design level (table structure, attributes, keys). | Operates purely at the mathematical constraint level (simplifying functional dependencies). |
Canonical cover is not a substitute for normalization. Instead, database designers compute a canonical cover as an initial step. Algorithms like the 3NF synthesis algorithm require a canonical cover as input to synthesize minimal, dependency-preserving relations.
Appeared: 2021 Q.6(b) β (05 Marks, Section B, CLO1)
Question:
Define Functional dependency. Consider the following functional dependency set:
FD={
AβBC,
CDβE,
BβD,
EβA
}
Find the canonical form of the FD set.
Full Answer:
A functional dependency is a formal constraint between two sets of attributes in a relational database.
Let relation schema R have attribute subsets Ξ±βR and Ξ²βR. The functional dependency:
Ξ±βΞ²holds on R if, in every legal relation instance r(R), whenever any two tuples t1β and t2β agree on all attributes of Ξ±, they must also agree on all attributes of Ξ²:
t1β[Ξ±]=t2β[Ξ±]βΉt1β[Ξ²]=t2β[Ξ²]We state that Ξ± functionally determines Ξ², or that Ξ² is functionally dependent on Ξ±. The left-hand side Ξ± is called the determinant, and the right-hand side Ξ² is called the dependent.
A canonical cover Fcβ must satisfy two conditions:
The given set is:
F={AβBC,CDβE,BβD,EβA}Step 1: Combine dependencies with identical left-hand sides
The left-hand sides of the dependencies are A,CD,B, and E. All left-hand sides are distinct. The union rule does not apply.
Step 2: Test for extraneous attributes
Examine AβBC:
Examine CDβE:
Examine BβD:
Both the LHS and RHS contain single attributes. Neither attribute can be removed without dropping the entire dependency. Attribute D cannot be derived from B without using BβD. Thus, neither attribute is extraneous.
Examine EβA:
Both the LHS and RHS contain single attributes. Neither attribute is extraneous.
Step 3: Final Canonical Cover
Because no extraneous attributes exist and all left-hand sides are unique, the canonical cover is identical to the given set:
(Note: In minimal cover form with singleton right-hand sides, the equivalent set is {AβB,AβC,CDβE,BβD,EβA}. In the standard textbook definition of canonical cover, dependencies with the same left-hand side remain combined.)
Source: Silberschatz 7e Β· Chapter 7 (Exercise 7.14)
Exam Relevance: Prime Overdue Exam Drill (Theory & Calculation)
Key Tested Concept: Demonstrating that a set of functional dependencies can produce multiple distinct canonical covers.
Problem Statement:
Show that a set of functional dependencies can have more than one canonical cover by finding two distinct canonical covers for the following set of dependencies on relation schema R=(A,B,C):
F={AβBC,BβAC,CβAB}
Model Exam-Style Solution:
Decompose Right-Hand Sides to Singleton Form:
Fsingleβ={AβB,AβC,BβA,BβC,CβA,CβB}Notice that all three attributes are mutually functionally equivalent: AβBβC.
Finding Canonical Cover 1 (Fc1β):
Finding Canonical Cover 2 (Fc2β):
Conclusion: A set of functional dependencies does not necessarily have a unique canonical cover. β
π‘ RUET Exam Takeaway: Whenever full mutual equivalence exists (AβBβC), alternating the cycle elimination order proves the non-uniqueness of canonical covers in 4 lines.
β Previous: T08.4: Attribute Closure and Finding Candidate Keys | π Index | Next: T08.6: Normal Forms β