Functional Dependencies in DBMS

1. What is Functional Dependency (FD)?

👉 A relationship where one column (or set of columns) determines another.

  • Example: Roll_No → Name (Knowing Roll_No gives Name).

2. Key Terms

  • Determinant = the predictor (e.g., Roll_No).
  • Dependent = the predicted (e.g., Name).

3. Why FD is Important?

✔ Removes redundancy
✔ Prevents anomalies (update/insert/delete problems)
✔ Helps normalize tables


4. Types of FD

  • Trivial: {A, B} → A (dependent is part of determinant).
  • Non-Trivial: A → B (dependent not part of determinant).

5. Keys & Closure

  • Candidate Key = Smallest set of columns that uniquely identify rows.
    Example: Roll_No.
  • Closure = All attributes you can find from a key.
    Example: Roll_No⁺ = {Roll_No, Name, Class}.

6. Why Decompose Tables?

Bad tables cause:

  • Redundancy (wasted space).
  • Update anomaly (change in many rows).
  • Insert anomaly (can’t add data without another).
  • Delete anomaly (deleting one row loses other info).

7. How to Decompose?

  • Lossless decomposition → No data is lost when splitting.
  • Dependency preservation → FDs still hold in decomposed tables.

8. Normal Forms (NF)

  • 1NF → No repeating groups, atomic values.
  • 2NF → No partial dependency (non-key column depends on part of key).
  • 3NF → No transitive dependency (non-key depends on another non-key).
  • BCNF → Every determinant must be a candidate key.

9. Steps to Solve FD Questions

  1. Find candidate keys.
  2. Find FDs.
  3. Check normal form (1NF → 2NF → 3NF → BCNF).
  4. Decompose if needed (lossless + dependency preserved).

10. Easy Memory Trick 🚀

FD = If I know this → I know that

Keys unlock the table

Normalize step by step:

BCNF → Determinant must be a key

1NF → Remove repeating data

2NF → Remove partial dependency

3NF → Remove transitive dependency