Functional Dependencies, Armstrong’s Axioms, and Normalization Basics
What is Normalization and Why Do We Need It? (In Simple Words)
When designing a database, beginners often make the mistake of dumping all data into one single giant table.
While this seems simple at first, storing unrelated information together introduces severe bugs known as Data Redundancy and Update Anomalies.
Normalization is a formal, step-by-step mathematical technique used to decompose bad, redundant tables into smaller, well-structured relations without losing any information (Lossless Decomposition).
1. The Three Update Anomalies
Consider an unnormalized table STUDENT_COURSE_FACULTY:
[ Roll_No, Student_Name, Course_ID, Course_Name, Faculty_Name, Faculty_Room ]
If an unnormalized table stores student enrollments and faculty room details together, three severe anomalies occur:
Practical Examples of the Anomalies:
- Insertion Anomaly: A new faculty member joins the college, but has not been assigned any students yet. Because
Roll_Nois part of the primary key and cannot be NULL, the college cannot insert the new faculty member into the database! - Deletion Anomaly: Student
Roll_No 105is the only student enrolled in “Cloud Computing”. If this student drops out and their record is deleted, the entire record of the Course and the Faculty teaching it is permanently lost from the college database! - Modification Anomaly: Faculty member “Dr. Sharma” moves from Room 101 to Room 205. If 500 students take Dr. Sharma’s course, the database must update 500 separate rows. If the server crashes after updating 300 rows, the database is left in a corrupted, inconsistent state!
2. Functional Dependency (FD)
A Functional Dependency (FD) is a constraint between two sets of attributes in a relation.
Formal Definition:
Given a relation R, an attribute Y is functionally dependent on attribute X (written as X → Y, read as “X functionally determines Y” or “Y is functionally dependent on X”), if and only if:
- Whenever two tuples have the same value for
X, they MUST have the exact same value forY. - Here,
Xis called the Determinant andYis called the Dependent.
Real-World Examples:
Roll_No → Student_Name: If two rows have the sameRoll_No, they must have the sameStudent_Name(A roll number uniquely determines a student).Aadhar_No → {Name, DOB, Address}: An Aadhar number uniquely identifies all personal details.ISBN → Book_Title: A book’s ISBN uniquely determines its title.{Course_ID, Semester} → Syllabus: A course ID and semester together determine the exact syllabus.
3. Types of Functional Dependencies
- Trivial Functional Dependency:
- An FD
X → Yis trivial ifYis a subset ofX(Y ⊆ X). - Example:
{Roll_No, Name} → Roll_No(Always guaranteed to be true by definition!).
- An FD
- Non-Trivial Functional Dependency:
- An FD
X → Yis non-trivial ifYis not a subset ofX(Y ⊄ X). - Example:
Roll_No → Name.
- An FD
- Completely Non-Trivial FD:
X ∩ Y = ∅(They share zero common attributes).
- Full Functional Dependency:
Ydepends on the entirety of composite keyX, not on any of its proper subparts.
- Partial Functional Dependency:
Ydepends on only a portion of a composite primary key. (This violates 2NF!).
- Transitive Functional Dependency:
- If
X → YandY → Z, then indirectlyX → Z. (This violates 3NF!).
- If
4. Armstrong’s Axioms (Inference Rules for FDs)
Formulated by William W. Armstrong in 1974, these axioms are the fundamental algebraic rules used to derive all possible functional dependencies from a given set of FDs:
The Primary Axioms:
- Axiom of Reflexivity:
- If
Y ⊆ X, thenX → Y. - Example:
{Roll_No, Name} → Name.
- If
- Axiom of Augmentation:
- If
X → Y, thenXZ → YZfor any attribute setZ. - Example: If
Roll_No → Name, then{Roll_No, Dept_ID} → {Name, Dept_ID}.
- If
- Axiom of Transitivity:
- If
X → YandY → Z, thenX → Z. - Example: If
Roll_No → Dept_IDandDept_ID → HOD_Name, thenRoll_No → HOD_Name.
- If
Secondary Derived Rules:
- Union Rule: If
X → YandX → Z, thenX → YZ. - Decomposition Rule: If
X → YZ, thenX → YandX → Z. - Pseudo-Transitivity Rule: If
X → YandWY → Z, thenWX → Z.
5. Attribute Closure and Finding Candidate Keys
The Attribute Closure of a set of attributes X (written as X⁺) is the set of all attributes that can be functionally determined by X using the given set of FDs.
Algorithm to Calculate Closure (X⁺):
- Initialize
X⁺ = X. - For every given FD
A → B:- If
A ⊆ X⁺, then addBtoX⁺(X⁺ = X⁺ ∪ B).
- If
- Repeat step 2 until no new attributes can be added.
Practical Exam Example:
Given Relation
R(A, B, C, D, E)with FDs:
A → BB → CC → DD → EFind the closure of A (A⁺):
- Step 1:
A⁺ = {A}- Using
A → B:A⁺ = {A, B}- Using
B → C:A⁺ = {A, B, C}- Using
C → D:A⁺ = {A, B, C, D}- Using
D → E:A⁺ = {A, B, C, D, E}Since
A⁺contains every attribute of relation R, A is a Super Key (and because it is a single attribute, A is a Candidate Key)!
💡 DAVV Exam Preparation Tips
5-Mark Question: “What are the three update anomalies in DBMS? Explain with a short example.”
- Define Insertion, Deletion, and Modification anomalies.
- Use the combined Student-Course-Faculty table example to illustrate all three clearly.
10-Mark Question: “State and prove Armstrong’s Axioms for functional dependencies. How do you find the attribute closure and candidate keys of a relation? Solve with an example.”
- State the 3 primary rules (Reflexivity, Augmentation, Transitivity) and 3 derived rules (Union, Decomposition, Pseudo-transitivity).
- Write out the step-by-step Attribute Closure algorithm.
- Provide the numerical example showing
A⁺ = {A, B, C, D, E}determining that A is the Candidate Key.