DBMS NOTES, IOE ,BSC CSIT,BCA
FUNCTIONAL DEPENDENCIES IN DBMS
In a relational database management system (DBMS), a functional dependency (FD) is a constraint that defines a relationship between attributes (columns) in a table. It essentially describes how the value in one or more attributes (determinant) determines the value in another attribute (dependent) within the same table.
It is denoted as X → Y, where the attribute set on the left side of the arrow, X is called Determinant, and Y is called the Dependent.
RULE FOR FINDING FUNCTIONAL DEPENDENCY
A functional dependency X->Y in a relation holds if two different values of Y are not related to same X.
Example:
Imagine a table storing information about Employees, with columns for EID, Name, and Department and Salary.
EID |
Name |
Department |
Salary |
1 |
Alice |
D1 |
45000 |
2 |
Bob |
D2 |
60000 |
3 |
Charlie |
D1 |
40000 |
4 |
Dave |
D3 |
45000 |
5 |
Eve |
D2 |
70000 |
In this scenario, the EID uniquely identifies each Employee. This relationship can be expressed as a functional dependency:
EID → Name
Here two different value of name will never have same EID. Hence functional dependency exist.
Some valid functional dependencies:
Some invalid functional dependencies:
Functional dependencies play a crucial role in database design for several reasons:
Armstrong’s axioms/properties of functional dependencies:
Types of Functional Dependencies
In Trivial Functional Dependency, a dependent is always a subset of the determinant. i.e. If X → Y and Y is the subset of X.
EID |
Name |
Salary |
1 |
Alice |
45000 |
2 |
Bob |
60000 |
3 |
Charlie |
40000 |
Here, {eid, name} → name is a trivial functional dependency, since the dependent name is a subset of the determinant set {roll_no, name}.
In Non-trivial functional dependency, the dependent is strictly not a subset of the determinant. i.e. If X → Y and Y is not a subset of X.
EID |
Name |
Salary |
1 |
Alice |
45000 |
2 |
Bob |
60000 |
3 |
Charlie |
40000 |
Here, {eid, name} → salary is also a non-trivial functional dependency, since salary is not a subset of {eid, name}
In transitive functional dependency, dependent is indirectly dependent on determinant. i.e. If a → b & b → c, then according to the axiom of transitivity, a → c. This is a transitive functional dependency.
For example,
EID |
Name |
Salary |
1 |
Alice |
45000 |
2 |
Bob |
60000 |
3 |
Charlie |
40000 |
Here, eid → name and name → salary. Hence, according to the axiom of transitivity, eid → salary is a valid functional dependency. This is an indirect functional dependency, hence called Transitive functional dependency.
In full functional dependency an attribute or a set of attributes uniquely determines another attribute or set of attributes. If a relation R has attributes X, Y, Z with the dependencies X->Y and X->Z which states that those dependencies are fully functional.
In partial functional dependency a non key attribute depends on a part of the composite key, rather than the whole key. If a relation R has attributes X, Y, Z where X and Y are the composite key and Z is non key attribute. Then X->Z is a partial functional dependency.
Note: Please study topic closure properties in dbms after this content