Database Management System (DBMS)
Functional Dependency

Functional Dependency (FD) is a fundamental concept in relational databases used to describe the relationship between attributes (columns) of a relation (table). It helps identify how data is connected and plays a crucial role in normalization, which is the process of organizing data to reduce redundancy.


What is a Functional Dependency?

In simple terms:

 

If you know the value of one attribute (or a set of attributes), and you can uniquely determine the value of another attribute, then there is a functional dependency.

 

We write this as:

A → B

 

This means:

  • Attribute A functionally determines attribute B.
  • For every value of A, there is exactly one corresponding value of B.

Example:

Consider this table:

StudentID Name Department
101 Anya CS
102 Rahul IT
103 Sneha CS

Here:

  • StudentID → Name (StudentID uniquely determines Name)
  • StudentID → Department (StudentID uniquely determines Department)

 

So, StudentID is the determinant, and Name and Department are dependent attributes.

 

But:

  • Department → Name is not a valid FD, because multiple students can be in the same department.

Types of Functional Dependencies:

Trivial FD

  • If B is a subset of A:
    A → B is trivial.
    Example: {StudentID, Name} → Name

 

Non-trivial FD

  • If B is not a subset of A.
    Example: StudentID → Name

 

Fully Functional Dependency

  • B depends on the entire set of A, not just a part.
    Used in 2NF.
    Example: {RollNo, Course} → Grade
    But not just RollNo → Grade

 

Transitive Dependency

  • A → B and B → C, then A → C
    Used to eliminate 3NF issues.
    Example:
    StudentID → DepartmentID,
    DepartmentID → DepartmentName,
    So, StudentID → DepartmentName (transitive)

Why Functional Dependency Matters

Functional dependencies help us identify candidate keys.

 

They are the foundation for normalization, which ensures that:

  • Data is organized efficiently.
  • Redundancy is minimized.
  • Update anomalies are reduced.
0% Complete
WhatsApp Icon

Hi Instagram Fam!
Get a FREE Cheat Sheet on System Design.

Hi LinkedIn Fam!
Get a FREE Cheat Sheet on System Design

Loved Our YouTube Videos? Get a FREE Cheat Sheet on System Design.