Hello! In our last lesson, we learned how to use INNER JOIN and LEFT JOIN to combine data from multiple tables. This is the practical skill of how to reassemble data. Today, we take a step back to understand why we structure data this way in the first place.
This lesson explores database normalization, a fundamental design principle for creating efficient, reliable, and scalable databases. We will cover its purpose and walk through the first three "normal forms" (1NF, 2NF, and 3NF), which are the industry standard. Mastering this concept is crucial for any backend developer because a well-designed database schema is the bedrock of a robust application, preventing a whole class of bugs and data inconsistencies before a single line of Java code is even written.
1. The Problem: Data Redundancy and Anomalies
Imagine storing all student enrollment data in a single, large table. At first, it might seem simple, but problems quickly emerge.

This design suffers from data redundancy—storing the same piece of information multiple times. In the table above, the details for the "Java" course are repeated for every student taking it. This redundancy isn't just inefficient; it leads to three specific types of problems known as data anomalies.
A video from the techTFQ channel provides an excellent, clear explanation of what normalization is and a breakdown of these three anomalies.
Complete guide to Database Normalization in SQL
This video offers a complete guide to normalization. We'll start with the introduction and then jump to the end to understand the problems normalization solves.
First, watch the introduction from the beginning to understand the basics of what normalization is and why 3NF is considered the industry standard. Then, skip to the final section of the video starting at the different anomalies. This part clearly illustrates the following three problems with a denormalized database: Insertion Anomaly: You can't add a new course until a student enrolls in it. Deletion Anomaly: If you delete the last student enrolled in a course, you lose all information about the course itself. Update Anomaly: If an instructor's contact number changes, you must find and update it in every single record, risking inconsistency if you miss one.
Normalization is the process of organizing the columns and tables of a relational database to minimize data redundancy and eliminate these destructive anomalies. It involves following a set of rules called "normal forms."
2. The Path to a Clean Design: 1NF, 2NF, and 3NF
We will now walk through the process of taking a "messy," denormalized table and cleaning it up by applying the rules of the first three normal forms. For this, we'll continue with the techTFQ video, which provides a fantastic, practical demonstration.
First Normal Form (1NF): Ensure Atomicity
The first step is the most basic. A table is in 1NF if it meets these conditions:
- Each column contains atomic (indivisible) values. A cell cannot contain a list of values like "Java, Python".
- Each row is unique, typically identified by a primary key.
- There are no "repeating groups" of columns (e.g.,
Item1,Item2,Item3).
Let's watch how to transform a table to meet these rules.
Complete guide to Database Normalization in SQL
This segment shows how to take a denormalized table and bring it into First Normal Form.
Watch from the beginning of the 1NF section. Pay close attention to how a row with multiple values in its columns is split into distinct, unique rows, ensuring each cell has only a single value.
Second Normal Form (2NF): Eliminate Partial Dependencies
Once a table is in 1NF, the next step is 2NF. This form deals with tables that have a composite primary key (a primary key made of two or more columns).
- Rule for 2NF: The table must be in 1NF, and every non-key column must depend on the entire composite primary key, not just a part of it.
A "partial dependency" occurs when a non-key column depends on only one part of the composite key. For example, in a table with a primary key of (OrderID, ProductID), a column like OrderDate depends only on OrderID, which is a partial dependency. This still leads to redundancy.
The solution is to split the table.
Complete guide to Database Normalization in SQL
This part explains how to identify and remove partial dependencies to achieve 2NF.
Continue watching from the 2NF section. The key concept here is splitting one large table into multiple, smaller tables (Orders, Products, Customers) and creating a new table to manage the relationships. This is precisely why we need the JOINs you learned about in the last lesson!
Third Normal Form (3NF): Eliminate Transitive Dependencies
3NF is the final and most common goal for transactional databases. It tackles a more subtle kind of dependency.
- Rule for 3NF: The table must be in 2NF, and every non-key column must depend only on the primary key. A non-key column cannot depend on another non-key column.
This is called a transitive dependency. If we have A -> B -> C (C depends on B, and B depends on A), then C has a transitive dependency on A.
Let's look at an example. Imagine a Teacher Details table.
TeacherID(Primary Key) ->StateState->Country
Here, Country depends on State, which is a non-key column. This is a transitive dependency. If all teachers from a certain state are removed, we might lose the fact that this state belongs to a certain country.

The solution, once again, is to split the table. The Decomplexify channel has a famous and very effective way to remember the rules for 1NF, 2NF, and 3NF combined:
"Every non-key attribute in a table should depend on the key, the whole key, and nothing but the key."
- "The key" (covered by 1NF) - Data must be uniquely identifiable.
- "The whole key" (covered by 2NF) - Eliminates partial dependencies.
- "Nothing but the key" (covered by 3NF) - Eliminates transitive dependencies.
Now, let's see the final step of our example transformation into 3NF.
Complete guide to Database Normalization in SQL
This final transformation segment deals with transitive dependencies.
Watch from the 3NF section. Observe how the employees (salesperson) information is moved from the Orders table into its own table to remove the transitive dependency, resulting in a fully normalized 3NF database schema.
3. Normalization in the Real World
Achieving 3NF is the standard for most online transaction processing (OLTP) systems, such as e-commerce sites, banking applications, and booking systems—the exact kind of applications you aim to build as a backend developer. It guarantees data integrity and minimizes storage.
However, it's worth knowing that in some specific cases, like data warehousing or reporting systems (OLAP), developers might intentionally denormalize data. This means combining tables and reintroducing some redundancy to make complex read queries faster by avoiding numerous joins. For your goal of building backend applications, prioritizing a clean, 3NF design is the correct approach.
For a final recap, let's turn to this excellent article from DigitalOcean which concisely defines each normal form.
Database Normalization: 1NF, 2NF, 3NF & BCNF Examples
This FAQ section provides a quick and clear summary of the first three normal forms.
Read the first question, "What is 1NF, 2NF, and 3NF in database normalization?". This will solidify the definitions and purpose of each stage we've just covered.
Conclusion
In this lesson, you've learned the "why" behind relational database design. We explored how unnormalized data leads to redundancy and anomalies, and we walked through the step-by-step process of applying 1NF, 2NF, and 3NF to create a clean, robust, and efficient database schema. This process of splitting large tables into smaller, logical units is precisely what makes JOINs such a necessary and powerful tool.
Key Takeaways:
- Normalization is a database design technique to reduce data redundancy and prevent insertion, update, and deletion anomalies.
- 1NF (First Normal Form): Ensures columns have atomic values and rows are unique.
- 2NF (Second Normal Form): Builds on 1NF and requires that all non-key attributes depend on the entire composite primary key (no partial dependencies).
- 3NF (Third Normal Form): Builds on 2NF and requires that non-key attributes depend only on the primary key (no transitive dependencies).
- The mantra for a 3NF-compliant design is that every attribute depends on "the key, the whole key, and nothing but the key."
Now that you understand the fundamentals of designing a database and querying it with SQL, our next step is to bridge the gap between theory and practice. In the next lesson, you will learn how to connect a Java application to a database using JDBC, allowing you to programmatically execute the SQL queries you've been learning.