Functional Dependencies in DBMS

Advanced Concepts and Rules

In the previous article, we understood the basic idea of Functional Dependency (FD), its notation, types, and relationship with keys.

In this article, we will move deeper into logical reasoning with Functional Dependencies. These concepts are important for solving problems and preparing for normalization.


1. Full Functional Dependency

A functional dependency X → Y is called a Full Functional Dependency if:

Y depends on the whole set of attributes in X, and not on any proper subset of X.

Example

Consider a table:

Student_ID

Course_ID

Grade

101

DBMS

A

101

OS

B

102

DBMS

A

Here:

(Student_ID, Course_ID) → Grade

Grade depends on both Student_ID and Course_ID together.

  • Student_ID alone cannot determine Grade.
  • Course_ID alone cannot determine Grade.

So, this is a Full Functional Dependency.


2. Partial Dependency

A functional dependency X → Y is called a partial dependency if:

Y depends only on a part of X (where X is a composite attribute).

Example

Consider:

Student_ID

Course_ID

Student_Name

101

DBMS

Aditi

101

OS

Aditi

102

DBMS

Rahul

Here:

(Student_ID, Course_ID) → Student_Name
But actually:

Student_ID → Student_Name

Student_Name does not depend on Course_ID.

So this is a Partial Dependency because Student_Name depends only on part of the composite key.


3. Transitive Dependency

A transitive dependency occurs when:

If
X → Y
and
Y → Z

Then
X → Z

Here, Z depends on X indirectly through Y.

Example

Employee_ID

Department_ID

Department_Name

1

D1

Sales

2

D2

HR

Here:

Employee_ID → Department_ID
Department_ID → Department_Name

Therefore:

Employee_ID → Department_Name

This is a Transitive Dependency.


4. Armstrong’s Axioms

Armstrong’s Axioms are a set of inference rules used to derive new functional dependencies from given ones.

There are three basic rules.


4.1 Reflexivity Rule

If Y is a subset of X, then:

X → Y

Example:

(A, B) → A

Since A is part of (A, B), this is always true.


4.2 Augmentation Rule

If:

X → Y

Then:

XZ → YZ

This means if X determines Y, adding the same attribute set Z to both sides keeps the dependency valid.

Example:

If
Student_ID → Name

Then
(Student_ID, Course_ID) → (Name, Course_ID)


4.3 Transitivity Rule

If:

X → Y
Y → Z

Then:

X → Z

This rule explains transitive dependency.


5. Derived Rules

Using Armstrong’s Axioms, we can derive additional rules.


5.1 Union Rule

If:

X → Y
X → Z

Then:

X → YZ

Example:

Roll_No → Name
Roll_No → Department

Then:

Roll_No → (Name, Department)


5.2 Decomposition Rule

If:

X → YZ

Then:

X → Y
X → Z

This is the opposite of a union.


5.3 Pseudotransitivity Rule

If:

X → Y
YZ → W

Then:

XZ → W

This rule is useful in solving complex FD problems.


6. Closure of Attributes (X)

The closure of an attribute set X, written as X, is the set of all attributes that can be functionally determined by X.

It is used to:

  • Find candidate keys
  • Check if a functional dependency is implied
  • Verify normalization conditions

Steps to Find Closure

  1. Start with X = X
  2. Apply all given functional dependencies
  3. Add attributes that can be determined
  4. Repeat until no more attributes can be added

Example

Relation: R(A, B, C, D)

Given:
A → B
B → C

Find A

Step 1: A = {A}
Step 2: A
B Add B
Step 3: B
C Add C

Final:

A = {A, B, C}


7. Finding Candidate Keys Using Closure

To find candidate keys:

  1. Start with possible attribute combinations.
  2. Find their closure.
  3. If closure contains all attributes of the relation, it is a super key.
  4. If no proper subset is a super key, it is a candidate key.

Example

Relation: R(A, B, C)

Given:
A → B
B → C

Find A:

A → B
B → C

So:

A = {A, B, C}

Since A determines all attributes, A is a candidate key.


Summary

In this article, we covered:

  • Full Functional Dependency
  • Partial Dependency
  • Transitive Dependency
  • Armstrong’s Axioms
  • Derived Rules
  • Closure of attributes
  • Finding candidate keys