
- DBMS - Home
- DBMS - Overview
- DBMS - Architecture
- DBMS - Data Models
- DBMS - Data Schemas
- DBMS - Data Independence
- DBMS - System Environment
- Centralized and Client/Server Architecture
- DBMS - Classification
- Relational Model
- DBMS - Codd's Rules
- DBMS - Relational Data Model
- DBMS - Relational Model Constraints
- DBMS - Relational Database Schemas
- DBMS - Handling Constraint Violations
- Entity Relationship Model
- DBMS - ER Model Basic Concepts
- DBMS - ER Diagram Representation
- Relationship Types and Relationship Sets
- DBMS - Weak Entity Types
- DBMS - Generalization, Aggregation
- DBMS - Drawing an ER Diagram
- DBMS - Enhanced ER Model
- Subclass, Superclass and Inheritance in EER
- Specialization and Generalization in Extended ER Model
- Data Abstraction and Knowledge Representation
- Relational Algebra
- DBMS - Relational Algebra
- Unary Relational Operation
- Set Theory Operations
- DBMS - Database Joins
- DBMS - Division Operation
- DBMS - ER to Relational Model
- Examples of Query in Relational Algebra
- Relational Calculus
- Tuple Relational Calculus
- Domain Relational Calculus
- Relational Database Design
- DBMS - Functional Dependency
- DBMS - Inference Rules
- DBMS - Minimal Cover
- Equivalence of Functional Dependency
- Finding Attribute Closure and Candidate Keys
- Relational Database Design
- DBMS - Keys
- Super keys and candidate keys
- DBMS - Foreign Key
- Finding Candidate Keys
- Normalization in Database Designing
- Database Normalization
- First Normal Form
- Second Normal Form
- Third Normal Form
- Boyce Codd Normal Form
- Difference Between 4NF and 5NF
- Structured Query Language
- Types of Languages in SQL
- Querying in SQL
- CRUD Operations in SQL
- Aggregation Function in SQL
- Join and Subquery in SQL
- Views in SQL
- Trigger and Schema Modification
- Storage and File Structure
- DBMS - Storage System
- DBMS - File Structure
- DBMS - Secondary Storage Devices
- DBMS - Buffer and Disk Blocks
- DBMS - Placing File Records on Disk
- DBMS - Ordered and Unordered Records
- Indexing and Hashing
- DBMS - Indexing
- DBMS - Single-Level Ordered Indexing
- DBMS - Multi-level Indexing
- Dynamic B- Tree and B+ Tree
- DBMS - Hashing
- Transaction and Concurrency
- DBMS - Transaction
- DBMS - Concurrency Control
- DBMS - Deadlock
- Backup and Recovery
- DBMS - Data Backup
- DBMS - Data Recovery
- DBMS Useful Resources
- DBMS - Quick Guide
- DBMS - Useful Resources
- DBMS - Discussion
Equivalence of Functional Dependencies
Functional dependencies are quite useful while making databases and designing proper table relations. Functional dependencies define relationships between attributes in a table; they help in normalizing the tables and ensuring data consistency as well.
A common question in this domain is how to compare two sets of functional dependencies and determine if they are equivalent. Read this chapter to get a good understanding of the concept of equivalence of functional dependencies and explain how to determine if one set is a subset of another, or if both sets are the same.
What is Equivalence of Functional Dependencies?
Consider there are two sets of functional dependencies, F and G. They are considered equivalent if −
- Every dependency in F can be derived from G.
- Every dependency in G can be derived from F.
In other words, F ⊆ G and G ⊆ F. If both conditions hold, then F and G are equal.
The Importance of Equivalence
It is important to have a good understanding of the concept of "equivalence" while designing databases or while performing normalization and query optimization. It ensures that dependencies are not repeated and helps to compare alternative dependency sets to see if they represent the same relationship.
How to Compare Two Sets of Functional Dependencies?
To check whether two Functional Dependencies are equivalent, we can use the "closure of attributes". The closure of an attribute set is the set of attributes that can be determined using the given functional dependencies.
The process involves −
- Calculating closures for attributes using one set of dependencies.
- Verifying if these closures match when computed using the other set.
- Repeating the process with the roles reversed to ensure equivalence.
Step-by-Step Example
Let us see one example for a relational schema R with attributes and two sets of functional dependencies F and G −
Set F | Set G |
---|---|
|
|
We will check if F and G are equivalent or not.
Step 1: Compute Closures Using G
We start by computing the closure of each attribute or attribute combination from F. Here we calculate them using the functional dependencies in G.
Closure of A Using G −
- A is in the closure by itself
- A → CD (from G): Add C and D to the closure
- Closure of A is: {A, C, D}
Closure of AC Using G −
- Start with AC
- A → CD (from G): Add C and D to the closure
- Closure of AC: {A, C, D}
Closure of E Using G −
- E is in the closure by itself
- E → AH (from G): Add A and H
- A → CD (from G): Add C and D using A
Closure of E: {E, A, H, C, D}
At this point, we have computed closures for A, AC, and E using G.
Step 2: Verify F ⊆ G
Now, we check if F’s dependencies are covered by G −
Dependency A → C from F −
- Closure of A using G: {A, C, D}
- C is in the closure, so A → C is valid in G
Dependency AC → D from F −
- Closure of AC using G: {A, C, D}
- D is in the closure, so AC → D is valid in G
Dependency E → A, H from F −
- Closure of E using G: {E, A, H, C, D}
- A and H are in the closure, so E → A, H is valid in G
Since all dependencies in F can be derived from G, F ⊆ G is true.
Step 3: Compute Closures Using F
Next, we compute closures for attributes in G, but this time using F.
Closure of A Using F −
- A is in the closure by itself
- A → C (from F): Add C to the closure
- AC → D (from F): Add D using AC
- Closure of A: {A, C, D}
Closure of E Using F −
- E is in the closure by itself
- E → A, H (from F): Add A and H
- A → C (from F): Add C
- AC → D (from F): Add D using AC
Closure of E: {E, A, H, C, D}
Step 4: Verify G ⊆ F
Finally, we check if G’s dependencies are covered by F −
Dependency A → CD from G −
- Closure of A using F: {A, C, D}
- C and D are in the closure, so A → CD is valid in F
Dependency E → AH from G −
- Closure of E using F: {E, A, H, C, D}
- A and H are in the closure, so E → AH is valid in F
Since all dependencies in G can be derived from F, G ⊆ F is true.
Conclusion: F and G Are Equivalent
From the above steps, we conclude that F ⊆ G and G ⊆ F. It means F and G are equivalent functional dependency sets.
Key Points to Note
Take a note of the following key points –
- Use Closures for Comparison − To compare two sets of dependencies, we must compute closures for each attribute or attribute set.
- Check Both Directions − Verify the subsets like F ⊆ G and G ⊆ F to ensure equivalence.
- Simplify Where Possible − Minimize the dependency sets before comparison to avoid unnecessary computations.
Conclusion
In this chapter, we understood how to determine the equivalence of functional dependencies. We started the discussion by understanding the concept and importance of equivalence, followed by a step-by-step process to compare two sets of dependencies.
Using closures, we verified that both sets could derive the same attributes, proving their equivalence. This process is needed in database design; it helps in identifying redundant dependencies and in performing schema normalization.