🔗 FUNCTIONAL DEPENDENCY
DBMS • Definition • Armstrong's Axioms • Examples • Step-by-Step
📘 Interactive DBMS Lesson
Click any button below to learn about Functional Dependency and Armstrong's Axioms.
Topics: Functional Dependency, Determinant, Dependent Attribute, Reflexivity, Augmentation, Transitivity, Union, Decomposition and step-by-step examples.
Click any button below to learn about Functional Dependency and Armstrong's Axioms.
Topics: Functional Dependency, Determinant, Dependent Attribute, Reflexivity, Augmentation, Transitivity, Union, Decomposition and step-by-step examples.
🔗 What is Functional Dependency?
A Functional Dependency (FD) describes a relationship
between attributes of a database table.
If the value of attribute X uniquely determines the value of attribute Y, then we write:
If the value of attribute X uniquely determines the value of attribute Y, then we write:
X → Y
It is read as: "X functionally determines Y."
Simple idea:
If two records have the same value of X, they must have the same value of Y.
If two records have the same value of X, they must have the same value of Y.
Example
Student_ID → Student_Name
If Student_ID is unique, it can determine the name of the student.
📊 Basic Example
| Student_ID | Name | Course |
|---|---|---|
| 101 | Rahul | BCA |
| 102 | Anita | BCA |
| 103 | Rohan | BBA |
1
Student_ID is unique for each student.
2
Student_ID 101 identifies Rahul.
3
Student_ID 102 identifies Anita.
4
Therefore Student_ID determines Student_Name.
Student_ID → Student_Name
Student_ID = Determinant
Student_Name = Dependent Attribute
Student_ID = Determinant
Student_Name = Dependent Attribute
🧠 Armstrong's Axioms
Armstrong's Axioms are inference rules used to derive
new Functional Dependencies from existing dependencies.
| Axiom | Formula | Simple Meaning |
|---|---|---|
| Reflexivity | X → Y | Y is already inside X |
| Augmentation | XZ → YZ | Add the same attribute |
| Transitivity | X → Z | Follow a dependency chain |
Easy way to remember:
🔵 Reflexivity = Already contained
🟣 Augmentation = Add
🟢 Transitivity = Chain
🔵 Reflexivity = Already contained
🟣 Augmentation = Add
🟢 Transitivity = Chain
1️⃣ Reflexivity
If Y is a subset of X, then:
X → Y
Example
{Student_ID, Name} → Student_ID
1
Start with {Student_ID, Name}.
2
Student_ID is already contained in the left side.
3
Therefore the complete set determines Student_ID.
{Student_ID, Name} → Student_ID
This follows the Reflexivity Axiom.
This follows the Reflexivity Axiom.
2️⃣ Augmentation
If:
X → Y
then adding the same attribute Z to both sides gives:
XZ → YZ
Example
Student_ID → Name
Add Course to both sides.
Student_ID, Course → Name, Course
1
Start with Student_ID → Name.
2
Choose Course as the additional attribute.
3
Add Course to the left side.
4
Add Course to the right side.
Student_ID, Course → Name, Course
3️⃣ Transitivity
If:
X → Y
Y → Z
Y → Z
then:
X → Z
Example
Student_ID → Department_ID
Department_ID → Department_Name
Department_ID → Department_Name
1
Student_ID determines Department_ID.
2
Department_ID determines Department_Name.
3
The dependency forms a chain.
4
Therefore Student_ID determines Department_Name.
Student_ID → Department_Name
Derived using Transitivity.
Derived using Transitivity.
⚙️ Derived Rules
1. Union Rule
X → Y
X → Z
Therefore
X → YZ
X → Z
Therefore
X → YZ
Example
Student_ID → Name
Student_ID → Course
Therefore:
Student_ID → Name, Course
Student_ID → Course
Therefore:
Student_ID → Name, Course
2. Decomposition Rule
X → YZ
Therefore:
X → Y
X → Z
Therefore:
X → Y
X → Z
3. Pseudotransitivity
X → Y
WY → Z
Therefore:
WX → Z
WY → Z
Therefore:
WX → Z
🧮 Step-by-Step FD Derivation
Given:
A → B
B → C
C → D
B → C
C → D
Find: A → D
1
Given A → B.
2
Given B → C.
3
Using Transitivity:
A → B and B → C
Therefore:
A → C
A → B and B → C
Therefore:
A → C
4
Given C → D.
5
Again use Transitivity:
A → C and C → D
Therefore:
A → D
A → C and C → D
Therefore:
A → D
🎯 FINAL ANSWER
A → D
Therefore A functionally determines D.
A → D
Therefore A functionally determines D.
🎓 Student Database Example
| Roll_No | Name | Course_ID | Course_Name |
|---|---|---|---|
| 101 | Rahul | C01 | BCA |
| 102 | Anita | C01 | BCA |
| 103 | Rohan | C02 | BBA |
Functional Dependencies
Roll_No → Name
Course_ID → Course_Name
Course_ID → Course_Name
1
Roll_No uniquely identifies a student.
2
Therefore Roll_No → Name.
3
Course_ID identifies a particular course.
4
Therefore Course_ID → Course_Name.
📋 Quick Summary
| Concept | Rule | Meaning |
|---|---|---|
| Functional Dependency | X → Y | X determines Y |
| Reflexivity | X → Y | Y is contained in X |
| Augmentation | XZ → YZ | Add same attribute |
| Transitivity | X → Z | Use dependency chain |
| Union | X → YZ | Combine dependencies |
| Decomposition | X → Y, X → Z | Split dependency |
❓ Short Questions & Answers
Q1. What is Functional Dependency?
Functional Dependency is a relationship where one attribute
or group of attributes determines another attribute.
Example: Student_ID → Student_Name
Example: Student_ID → Student_Name
Q2. What are Armstrong's Axioms?
The three basic Armstrong's Axioms are:
1. Reflexivity
2. Augmentation
3. Transitivity
1. Reflexivity
2. Augmentation
3. Transitivity
Q3. What is Reflexivity?
If Y is a subset of X, then X → Y.
Q4. What is Augmentation?
If X → Y, then XZ → YZ.
The same attribute is added to both sides.
Q5. What is Transitivity?
If X → Y and Y → Z, then X → Z.
Q6. In A → B, which is the determinant?
A is the determinant because it appears
on the left side.
Q7. In A → B, which is the dependent attribute?
B is the dependent attribute because it appears
on the right side.
No comments:
Post a Comment