| Lesson 5 | Achieve 3NF |
| Objective | Translate Relations into Third Normal Form. |
In earlier lessons, we explored the limitations of Second Normal Form (2NF) and learned how to eliminate partial dependencies. This lesson takes the process one step further—showing how to translate relations into Third Normal Form (3NF) to ensure data consistency, reduce redundancy, and eliminate transitive dependencies within your database schema.
Normalization is a systematic process that progresses through successive stages, each addressing specific types of redundancy or dependency. To transform a relation into Third Normal Form, follow these general steps:
At each normalization stage, ensure that relationships between tables are maintained through primary keys and foreign keys, which preserve referential integrity. The process often involves decomposing larger, complex tables into smaller, more focused relations that represent distinct entities.
A transitive dependency occurs when a non-key attribute depends on another non-key attribute rather than directly on the primary key. For example:
Student (StudentID, CourseID, InstructorName, InstructorOffice)
In the above relation, InstructorName and InstructorOffice are dependent on CourseID rather than directly on StudentID. This is a transitive dependency because one non-key attribute (CourseID) determines another non-key attribute (InstructorOffice).
To eliminate this dependency, you would separate the relation into two tables:
Student (StudentID, CourseID)
Course (CourseID, InstructorName, InstructorOffice)
By restructuring the schema in this way, each non-key attribute now depends directly on the primary key of its respective table—achieving Third Normal Form (3NF).
While achieving 3NF enhances data integrity and prevents anomalies, over-normalization can sometimes reduce query performance by increasing the number of joins required. For operational databases (OLTP systems), 3NF provides an optimal balance between structural clarity and efficiency. However, for analytical workloads (OLAP systems), selective denormalization may be more appropriate.
A relation is in Third Normal Form if it meets both of the following conditions:
When transforming a 2NF relation into 3NF, ensure that any moved attributes retain referential connections to their original relations. This is achieved by preserving the foreign key, which allows the original user view to be reconstructed through SQL joins.
SELECT s.StudentID, s.CourseID, c.InstructorName, c.InstructorOffice
FROM Student s
JOIN Course c ON s.CourseID = c.CourseID;
This query reconstructs the original user view using a join, confirming that normalization does not result in loss of information.
Third Normal Form (3NF) removes transitive dependencies and ensures that all attributes depend solely on the primary key. By applying these principles, database designers create structures that are logically sound, maintainable, and resistant to data anomalies. In the next lesson, we will review Codd’s 12 rules for a fully relational database system.