Functional Dependency in DBMS

Introduction and Basic Concepts

Functional Dependency (FD) is one of the most important concepts in Database Management Systems (DBMS). It forms the foundation of normalization and helps in designing a well-structured relational database.

In simple words, a Functional Dependency describes a relationship between attributes in a relation (table).


1. What is a Functional Dependency?

A Functional Dependency is a constraint between two sets of attributes in a relation.

If the value of one attribute (or a set of attributes) determines the value of another attribute, then we say there is a functional dependency between them.

It is written as:

X → Y

This means:
If two tuples (rows) have the same value for attribute X, then they must also have the same value for attribute Y.

Here:

  • X is called the determinant
  • Y is called the dependent attribute

2. Understanding Functional Dependency with an Example

Consider the following Student table:

Roll_No

Name

Department

Email

101

Aditi

CSE

aditi@xyz.com

102

Rahul

ECE

rahul@xyz.com

103

Meera

CSE

meera@xyz.com

In this table:

Roll_No → Name
Roll_No → Department
Roll_No → Email

This is because each Roll_No uniquely identifies the student's details.

If two rows have the same Roll_No, they must have the same Name, Department, and Email.

So, Roll_No functionally determines the other attributes.


3. Determinant and Dependent

In a functional dependency X → Y:

  • X is called the determinant.
  • Y is called the dependent attribute.

Example:
Roll_No → Name

Here:

  • Roll_No is the determinant
  • Name is the dependent attribute

The determinant is responsible for uniquely identifying the dependent attribute.


4. Functional Dependency with Multiple Attributes

Sometimes, a combination of attributes determines another attribute.

Example:

(Student_ID, Course_ID) → Grade

This means:
A student’s grade depends on both Student_ID and Course_ID together.

Neither Student_ID alone nor Course_ID alone can determine Grade.

This is called a composite determinant.


5. Types of Functional Dependencies (Basic Classification)

5.1 Trivial Functional Dependency

A functional dependency X → Y is trivial if Y is a subset of X.

Example:
(A, B) → A

This is trivial because A is already part of (A, B).

Trivial dependencies always hold.


5.2 Non-Trivial Functional Dependency

A functional dependency X → Y is non-trivial if Y is not a subset of X.

Example:
Roll_No → Name

Here, Name is not part of Roll_No.
So, this is a non-trivial functional dependency.


5.3 Completely Non-Trivial Functional Dependency

A functional dependency X → Y is completely non-trivial if:

X and Y have no common attributes.

Example:
Roll_No → Department

Roll_No and Department are completely different attributes.


6. Functional Dependency and Keys

Functional Dependency is closely related to keys.

If an attribute (or set of attributes) functionally determines all other attributes in a table, then it is a candidate key.

Example:

Roll_No → Name
Roll_No → Department
Roll_No → Email

Since Roll_No determines all other attributes, it is a candidate key.

Thus:
Every key creates functional dependencies.
But not every functional dependency is a key.


7. Why Functional Dependency is Important

Functional Dependency helps in:

  • Identifying candidate keys
  • Removing redundancy
  • Avoiding update anomalies
  • Designing normalized databases
  • Ensuring data consistency

Without understanding functional dependencies, normalization cannot be properly understood.


8. How to Identify Functional Dependencies in Real Scenarios

To identify functional dependencies:

  1. Look for attributes that uniquely identify other attributes.
  2. Check real-world rules or constraints.
  3. Ask:
    If two rows have the same value of X, must they have the same value of Y?

If yes, then X → Y exists.

Example:

  • Employee_ID → Employee_Name
  • Aadhaar_Number → Person_Name
  • ISBN → Book_Title

These are real-world functional dependencies.


Summary

  • A Functional Dependency describes a relationship between attributes.
  • It is written as X → Y.
  • X is the determinant, Y is the dependent.
  • Functional dependencies help identify keys.
  • They are essential for normalization and proper database design.