SQL Topics
Third Normal Form 3NF
title: Third Normal Form 3NF
In the previous lesson, you learned about Second Normal Form (2NF) and how it eliminates Partial Dependencies.
A table in 2NF ensures that every non-key attribute depends on the entire primary key.
However, even after removing partial dependencies, some redundancy may still remain.
This happens because certain non-key columns may depend on other non-key columns instead of directly depending on the primary key.
This problem is known as:
Transitive DependencyTo eliminate transitive dependencies and further improve database design, we use:
Third Normal Form (3NF)Third Normal Form is one of the most commonly used normalization levels in real-world database systems because it significantly reduces redundancy while maintaining practical database performance.
What is Third Normal Form (3NF)?
A table is said to be in Third Normal Form (3NF) if:
It Is Already In 2NF
AND
Contains No Transitive DependencyIn simple words:
Every Non-Key Column
Must Depend Directly
On The Primary Keyand not on another non-key column.
Why is 3NF Important?
Even in a 2NF table, duplicate information may still exist.
Example:
| EmployeeID | EmployeeName | DepartmentID | DepartmentName |
|---|---|---|---|
| 1 | Rahul | 101 | HR |
| 2 | Priya | 101 | HR |
| 3 | Amit | 102 | IT |
Notice:
DepartmentNamedepends on:
DepartmentIDinstead of:
EmployeeIDThis creates redundancy.
3NF removes this issue.
Understanding Transitive Dependency
A Transitive Dependency occurs when:
Primary Key
↓
Non-Key Column
↓
Another Non-Key ColumnIn other words:
A Non-Key Attribute
Depends On
Another Non-Key Attributeinstead of directly depending on the primary key.
Simple Example
Table:
| EmployeeID | DepartmentID | DepartmentName |
|---|---|---|
| 1 | 101 | HR |
Dependencies:
EmployeeID
↓
DepartmentID
↓
DepartmentNameSince:
DepartmentNamedepends on:
DepartmentIDand not directly on:
EmployeeIDa Transitive Dependency exists.
Why is Transitive Dependency a Problem?
Transitive dependencies cause:
Data Redundancy
Update Anomalies
Insert Anomalies
Delete AnomaliesExample:
If:
HRchanges to:
Human ResourcesEvery employee row must be updated.
Missing even one row creates inconsistent data.
Example of a Table Not in 3NF
| EmployeeID | EmployeeName | DepartmentID | DepartmentName |
|---|---|---|---|
| 1 | Rahul | 101 | HR |
| 2 | Priya | 101 | HR |
| 3 | Amit | 102 | IT |
Primary Key:
EmployeeIDProblem:
DepartmentName
Depends On
DepartmentIDTherefore:
Not In 3NFConverting to Third Normal Form
To remove transitive dependency, separate department information into its own table.
Employees Table
| EmployeeID | EmployeeName | DepartmentID |
|---|---|---|
| 1 | Rahul | 101 |
| 2 | Priya | 101 |
| 3 | Amit | 102 |
Departments Table
| DepartmentID | DepartmentName |
|---|---|
| 101 | HR |
| 102 | IT |
Now:
DepartmentName
Stored Only Onceand:
No Transitive Dependency ExistsDependency Analysis
Before 3NF:
EmployeeID
↓
DepartmentID
↓
DepartmentNameAfter 3NF:
EmployeeID
↓
DepartmentIDand
DepartmentID
↓
DepartmentNamestored in a separate table.
Another Example
Before 3NF:
| StudentID | StudentName | CourseID | CourseName |
|---|---|---|---|
| 1 | Rahul | C101 | DBMS |
| 2 | Priya | C101 | DBMS |
Problem:
CourseName
Depends On
CourseIDAfter 3NF
Students
| StudentID | StudentName | CourseID |
|---|
Courses
| CourseID | CourseName |
|---|
Redundancy removed.
Real-World Example: University System
Wrong Design:
| StudentID | StudentName | DepartmentID | DepartmentName |
|---|
Department information repeats.
Correct Design:
Students
| StudentID | StudentName | DepartmentID |
|---|
Departments
| DepartmentID | DepartmentName |
|---|
Now the design follows 3NF.
Real-World Example: Banking
Wrong Design:
| AccountID | CustomerID | BranchID | BranchName |
|---|
BranchName depends on BranchID.
Correct Design:
Accounts
| AccountID | CustomerID | BranchID |
|---|
Branches
| BranchID | BranchName |
|---|
Now the database is in 3NF.
Real-World Example: E-Commerce
Wrong Design:
| OrderID | ProductID | ProductName |
|---|
ProductName depends on ProductID.
Correct Design:
Orders
| OrderID | ProductID |
|---|
Products
| ProductID | ProductName |
|---|
Redundancy eliminated.
Rules for Achieving 3NF
A table must:
Be In 1NFand
Be In 2NFand
Contain No Transitive DependencyEvery non-key attribute must depend:
Only On The Primary KeyBenefits of Third Normal Form
Reduces Data Redundancy
Duplicate information is minimized.
Eliminates Transitive Dependency
Main objective of 3NF.
Improves Data Consistency
Updates occur in one location.
Simplifies Maintenance
Database becomes easier to manage.
Better Data Integrity
Relationships remain accurate.
Widely Used In Industry
Many production databases are designed up to 3NF.
Limitations of 3NF
Although 3NF removes transitive dependencies, some dependency issues may still remain.
Certain complex dependency scenarios require:
Boyce-Codd Normal Form (BCNF)which is stricter than 3NF.
Common Mistakes
Confusing Partial and Transitive Dependency
2NF removes:
Partial Dependency3NF removes:
Transitive DependencyStoring Reference Data Repeatedly
Examples:
Department Names
Course Names
Branch Namesshould often be moved to separate tables.
Overlooking Dependency Chains
Always analyze:
Primary Key
↓
Non-Key
↓
Non-Keyrelationships.
Best Practices
Normalize Step by Step
Always follow:
1NF
↓
2NF
↓
3NFIdentify Indirect Dependencies
Look for non-key to non-key relationships.
Create Lookup Tables
Separate reference information.
Use Foreign Keys
Maintain relationships properly.
Document Dependencies
Understand how data relates.
Common Interview Questions
What is Third Normal Form (3NF)?
A table is in 3NF if it is in 2NF and contains no transitive dependencies.
What is a Transitive Dependency?
A non-key attribute depending on another non-key attribute.
What problem does 3NF solve?
Transitive dependency and related redundancy.
Does 3NF require 2NF?
Yes.
A table must already satisfy 2NF before it can satisfy 3NF.
Is 3NF enough for most databases?
Yes.
Many real-world systems are designed up to 3NF.
Summary
Third Normal Form (3NF) is a database normalization stage that removes transitive dependencies and ensures that every non-key attribute depends directly on the primary key. It reduces redundancy, improves consistency, and creates cleaner, more maintainable database structures.
In this lesson, you learned:
- What Third Normal Form is
- Transitive Dependency
- Why Transitive Dependency is a problem
- Converting tables to 3NF
- Real-world examples
- Benefits and limitations
- Best practices
- Interview questions
Mastering 3NF is essential because it is one of the most widely used normalization levels in modern database design.
Next Step
Continue to the next lesson:
Boyce-Codd Normal Form (BCNF) →
Exam Focus
Revise definitions, diagrams, examples, and short-answer points for Third Normal Form 3NF.
Interview Use
Prepare one clear explanation, one practical example, and one common mistake for this SQL topic.
Search Terms
sql, sql complete guide, sql tutorial, sql notes, complete, guide, normalization, third
Related SQL Topics