0% found this document useful (0 votes)
30 views4 pages

Database Normalization: 1NF to 3NF Guide

Normalization is the process of organizing database data to reduce redundancy and improve integrity, involving decomposing tables into smaller relations. The document outlines the rules and examples for the first three normal forms (1NF, 2NF, and 3NF), emphasizing the importance of atomic values, full dependency on primary keys, and the elimination of transitive dependencies. It concludes with a summary of key requirements for each normal form and tips for effective normalization.

Uploaded by

tazvirrahat12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views4 pages

Database Normalization: 1NF to 3NF Guide

Normalization is the process of organizing database data to reduce redundancy and improve integrity, involving decomposing tables into smaller relations. The document outlines the rules and examples for the first three normal forms (1NF, 2NF, and 3NF), emphasizing the importance of atomic values, full dependency on primary keys, and the elimination of transitive dependencies. It concludes with a summary of key requirements for each normal form and tips for effective normalization.

Uploaded by

tazvirrahat12
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Normalization Tutorial: 1NF to 3NF

Database Systems Handout

What is Normalization?

Normalization is the process of organizing data in a database to reduce redundancy and


improve data integrity. It involves decomposing tables into smaller, well-structured relations.

First Normal Form (1NF)

Rule: A table is in 1NF if:

• All values are atomic (indivisible),

• No repeating groups or arrays.

Example (Unnormalized):

StudentID Name Courses


1001 Alice Math, Physics
1002 Bob Chemistry

Converted to 1NF:

StudentID Name Course


1001 Alice Math
1001 Alice Physics
1002 Bob Chemistry

1
Second Normal Form (2NF)

Rule: A table is in 2NF if:

• It is in 1NF,

• All non-prime attributes are fully dependent on the whole primary key (no partial
dependency).

Example (1NF but not 2NF):

StudentID CourseID Grade StudentName CourseName


1001 CS101 A Alice Data Structures
1002 MA102 B Bob Calculus

Issues:
• StudentName depends only on StudentID,

• CourseName depends only on CourseID.

2NF Decomposition:
• Students(StudentID, StudentName)

• Courses(CourseID, CourseName)

• Enrollment(StudentID, CourseID, Grade)

Third Normal Form (3NF)

Rule: A table is in 3NF if:

• It is in 2NF,

• No transitive dependency (non-prime attribute should not depend on another non-


prime attribute).

2
Example (2NF but not 3NF):

Given Relation:

OrderID CustomerID ProductID Quantity CustomerName


O01 C001 P101 2 Alice
O02 C002 P102 1 Bob
O01 C001 P102 3 Alice

Functional Dependencies:

• (OrderID, ProductID) → Quantity

• CustomerID → CustomerName

• OrderID → CustomerID

Candidate Key: (OrderID, ProductID)

Check for 2NF:

- The composite key is (OrderID, ProductID). - All non-key attributes depend on the
entire key or non-key attributes. - No partial dependency exists since:

• Quantity depends on full key (OrderID, ProductID).

• CustomerName depends on CustomerID (non-key attribute), so it does not violate


2NF (which focuses on partial dependencies on keys).

Thus, the relation is in 2NF.

However, transitive dependency exists:

- CustomerName depends on CustomerID, which depends on OrderID. - This violates


3NF because CustomerName is transitively dependent on the candidate key via CustomerID.

Decompose to achieve 3NF:

Separate into two relations:

3
• Orders(OrderID, CustomerID)
• Customer(CustomerID, CustomerName)
• OrderDetails(OrderID, ProductID, Quantity)

Final Relations:

Orders Table:

OrderID CustomerID
O01 C001
O02 C002

Customer Table:

CustomerID CustomerName
C001 Alice
C002 Bob

OrderDetails Table:

OrderID ProductID Quantity


O01 P101 2
O02 P102 1
O01 P102 3

Summary of Normal Forms

Normal Form Key Requirement


1NF Atomic attributes, no repeating groups
2NF No partial dependency on composite keys
3NF No transitive dependency

Tips
• Always identify candidate keys and functional dependencies.
• Normalize only until needed: 3NF is usually sufficient for practical purposes.

You might also like