A Functional Dependency is a relationship between attributes in a table.
Notation: A β B
π If we know A, we can uniquely determine B
| STUD_ID | NAME | DEPT |
|---|---|---|
| 101 | Amit | CSE |
| 102 | Ravi | ECE |
Given Table:
| A | B | C |
|---|---|---|
| 1 | 4 | 2 |
| 3 | 5 | 6 |
| 3 | 4 | 6 |
| 7 | 3 | 8 |
| 9 | 1 | 0 |
Check whether the following functional dependencies hold:
Check rows where (A, B) are same:
π No violation found
Check rows where (B, C) are same:
π No violation found
Check rows where (A, C) are same:
Check corresponding B values:
Since same (A, C) gives different B values β violation occurs
A functional dependency A β B is called trivial if B is a subset of A.
π In simple words, if the right-hand side attribute is already present in the left-hand side, then it is trivial.
Condition: B β A
Example:
A functional dependency A β B is called non-trivial if B is NOT a subset of A.
π This means the dependency gives new and useful information.
Condition: B β A
Example:
If A and B have no common attributes, then it is called completely non-trivial dependency.
Example: Roll No β Name
| Trivial | Non-Trivial |
|---|---|
| B β A | B β A |
| No new information | Provides new information |
| Always true | Depends on data |
If Y β X, then X β Y
Example: (Roll No, Name) β Name
If X β Y, then XW β YW
Example: If Roll No β Name, then (Roll No, Dept) β (Name, Dept)
If X β Y and Y β Z, then X β Z
Example: Roll No β Dept and Dept β HOD, so Roll No β HOD
If X β Y and WY β Z, then WX β Z
Example: If A β B and CB β D, then CA β D
If X β Y and X β Z, then X β YZ
Example: If Roll No β Name and Roll No β Dept, then Roll No β (Name, Dept)
If X β YZ, then X β Y and X β Z
Example: If Roll No β (Name, Dept), then Roll No β Name and Roll No β Dept
Functional Dependency shows relationship between attributes, not rows.
Does A β B mean every value must be different?