Functional Dependency (FD)

A Functional Dependency is a relationship between attributes in a table.

πŸ‘‰ If one attribute determines another β†’ it is called Functional Dependency

Notation: A β†’ B

πŸ‘‰ If we know A, we can uniquely determine B

πŸ“Š Example

STUD_ID NAME DEPT
101 Amit CSE
102 Ravi ECE

πŸ” Analysis

πŸ‘‰ STUD_ID uniquely determines NAME and DEPT

πŸ“Š Functional Dependency Example (GATE Level)

Given Table:

A B C
142
356
346
738
910
---

🎯 Goal

Check whether the following functional dependencies hold:

---

βš™οΈ Rule to Check Functional Dependency

πŸ‘‰ If two rows have same LHS values, then RHS must also be same
---

πŸ” Check AB β†’ C

Check rows where (A, B) are same:

πŸ‘‰ No violation found

βœ… AB β†’ C holds
---

πŸ” Check BC β†’ A

Check rows where (B, C) are same:

πŸ‘‰ No violation found

βœ… BC β†’ A holds
---

πŸ” Check AC β†’ B

Check rows where (A, C) are same:

Check corresponding B values:

Since same (A, C) gives different B values β†’ violation occurs

❌ AC β†’ B does NOT hold
---

πŸ’£ Final Answer

πŸ‘‰ Final Conclusion: Only AC β†’ B is violated

Types of Functional Dependency

1. Trivial Functional Dependency

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:

πŸ‘‰ No new information is added πŸ‘‰ Always true

2. Non-Trivial Functional Dependency

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:

πŸ‘‰ Provides useful information πŸ‘‰ Helps in finding keys

3. Completely Non-Trivial Dependency

If A and B have no common attributes, then it is called completely non-trivial dependency.

Example: Roll No β†’ Name

Difference Between Trivial and Non-Trivial

Trivial Non-Trivial
B βŠ† A B βŠ„ A
No new information Provides new information
Always true Depends on data

Armstrong’s Inference Rules

1. Reflexivity (Basic Rule)

If Y βŠ† X, then X β†’ Y

Example: (Roll No, Name) β†’ Name

2. Augmentation (Basic Rule)

If X β†’ Y, then XW β†’ YW

Example: If Roll No β†’ Name, then (Roll No, Dept) β†’ (Name, Dept)

3. Transitivity (Basic Rule)

If X β†’ Y and Y β†’ Z, then X β†’ Z

Example: Roll No β†’ Dept and Dept β†’ HOD, so Roll No β†’ HOD

Derived Rules

4. Pseudotransitivity

If X β†’ Y and WY β†’ Z, then WX β†’ Z

Example: If A β†’ B and CB β†’ D, then CA β†’ D

5. Union (Additivity)

If X β†’ Y and X β†’ Z, then X β†’ YZ

Example: If Roll No β†’ Name and Roll No β†’ Dept, then Roll No β†’ (Name, Dept)

6. Decomposition (Projectivity)

If X β†’ YZ, then X β†’ Y and X β†’ Z

Example: If Roll No β†’ (Name, Dept), then Roll No β†’ Name and Roll No β†’ Dept

πŸ‘‰ These rules are used to find attribute closure, candidate keys, and normalization.

πŸ’£ Important Concept

Functional Dependency shows relationship between attributes, not rows.

πŸ‘‰ It is used in Normalization and finding Candidate Keys

🀯 Common Confusion

Does A β†’ B mean every value must be different?

❌ NO

πŸ‘‰ It means: same A value β†’ same B value

Why Functional Dependency is Important?

🎯 GATE Important Points

πŸš€ Continue Learning

πŸ‘‰ Next Topic: Clouser β†’

πŸ”— Related Topics