Functional Dependencies in DBMS
β± Estimated reading time: 2 min
Functional Dependency (FD) is a fundamental concept in relational database theory used to describe the relationship between attributes in a relation. It forms the basis of normalization, helps in detecting anomalies, and ensures data integrity.
Definition
A functional dependency exists between two sets of attributes X and Y in a relation R if:
β‘οΈ X uniquely determines Y
This is written as:
X β Y
This means:
If two tuples have the same value of X, they must also have the same value of Y.
Example:
StudentID β StudentName
If StudentID is known, the StudentName is uniquely determined.
Types of Functional Dependencies
1οΈβ£ Trivial Functional Dependency
A dependency is trivial if the right-hand side is a subset of the left-hand side.
Example:
{A, B} β A (Trivial FD)
These dependencies always hold true.
2οΈβ£ Non-Trivial Functional Dependency
If Y is not a subset of X, then X β Y is non-trivial.
Example:
RollNo β StudentName
3οΈβ£ Fully Functional Dependency
A non-key attribute is fully functionally dependent on the whole candidate key, not on a part of it.
Example:
In a relation with key (StudentID, CourseID):
(StudentID, CourseID) β Grade
This is a full FD.
4οΈβ£ Partial Dependency
If a non-key attribute depends only on part of a composite key, it is partial dependency.
Example:
StudentID β StudentName
(from composite key (StudentID, CourseID))
Partial dependencies violate 2NF.
5οΈβ£ Transitive Dependency
A β B and B β C implies A β C (indirect dependency)
Example:
StudentID β Department
Department β HOD
So, StudentID β HOD (transitive)
Transitive dependencies violate 3NF.
6οΈβ£ Multivalued Dependency (MVD)
Used in 4NF.
X β Y means Y values are independent of other attributes and multiple values may exist.
Why Functional Dependencies Are Important?
FDs help to:
β Design efficient database structures
β Remove redundancy
β Identify candidate keys
β Perform normalization
β Avoid anomalies (update, insert, delete)
Example: Functional Dependencies in a Table
Consider a table:
| RollNo | Name | Course | Dept |
|---|
Possible FDs:
-
RollNo β Name
-
RollNo β Course
-
Course β Dept
Using these, we can identify keys and normalize the table.
Armstrongβs Axioms (Rules for FD Inference)
-
Reflexivity: If Y β X, then X β Y
-
Augmentation: If X β Y, then XZ β YZ
-
Transitivity: If X β Y and Y β Z, then X β Z
Using these axioms, new FDs can be derived.
Conclusion
Functional Dependencies are crucial in relational database design. They describe how attributes relate to each other, helping detect redundant data, find candidate keys, and guide normalization (1NF to BCNF and beyond). Understanding FDs ensures efficient, consistent, and logically structured databases.
Register Now
Share this Post
β Back to Tutorials