Third Normal Form (3NF) in Relational Database Design
Third normal form (3NF) is a database-design principle that reduces redundancy and anomalies by removing transitive dependencies; it requires 2NF and additional constraints on functional dependencies.
Third normal form (3NF) is a standard condition in relational database normalization intended to reduce redundancy and prevent update, insert, and delete anomalies. It builds on earlier normal forms and applies constraints to the functional dependencies among columns so that each non-key attribute depends only on a key, not on another non-key attribute.
Definition and formal criteria
A table is in third normal form when it meets two conditions: it is already in second normal form and, for every non-trivial functional dependency X → A, at least one of the following holds: X is a superkey of the relation, or A is a prime attribute (part of some candidate key). In more common terms, 3NF prohibits transitive dependencies in which a non-key column depends on another non-key column that depends on the primary key.
Key concepts and characteristics
- Primary key and candidate keys: Attributes or combinations that uniquely identify rows; non-key attributes must depend on these keys.
- Functional dependency: A relationship X → Y means values of X determine values of Y; 3NF inspects these dependencies to decide if decomposition is needed.
- Transitive dependency: A → B and B → C situations are problematic if A is a key and C is a non-key; 3NF removes such indirect dependencies.
- Lossless decomposition and dependency preservation: Proper decomposition to achieve 3NF should allow the original table to be reconstructed without spurious rows and, where practical, preserve functional dependencies.
How to reach 3NF (typical procedure)
- Ensure the relation is in first and second normal form (see 2NF).
- Identify all functional dependencies and candidate keys.
- Find transitive dependencies where a non-key attribute determines another non-key attribute.
- Decompose the relation into smaller relations so that each non-key attribute depends only on a key.
- Verify the decomposition is lossless and, if possible, dependency-preserving.
Example and practical effects
Consider a single table that stores student records with columns (StudentID, StudentName, DeptID, DeptName). If DeptName is determined by DeptID, and DeptID is associated with StudentID, then DeptName depends transitively on StudentID. Moving departmental information into a separate Department table (DeptID, DeptName) leaves the Student table with (StudentID, StudentName, DeptID) and eliminates the transitive dependency. This reduces repetition of DeptName values, and avoids inconsistencies when a department name changes.
History and relation to other normal forms
Normalization concepts trace back to Edgar F. Codd in the early development of the relational model (relational model). Third normal form is one of the canonical forms used in practice; a stricter variant, Boyce–Codd Normal Form (BCNF), was articulated later to handle some edge cases. BCNF requires that for every non-trivial functional dependency the determinant be a superkey, whereas 3NF allows the dependent attribute to be a prime attribute, making 3NF slightly less restrictive but often more practical.
Benefits, trade-offs and when to relax 3NF
3NF improves data integrity and minimizes redundant storage, which simplifies maintenance and reduces anomaly risk. The trade-off is additional joins at query time; for high-performance systems, designers sometimes denormalize parts of the schema to avoid expensive joins. Choosing 3NF is a balance between logical clarity and runtime performance, and it remains a widely recommended step in designing robust relational schemas (tables).
Questions and answers
Q: What is a third normal form?
A: Third normal form (3NF) is a property of a relational model and a criterion of database normalization.
Q: What is the first requirement for a table to be considered in third normal form?
A: The first requirement for a table to be considered in third normal form is that it must already be in second normal form.
Q: What does it mean for data in a column to be dependent only on columns that are part of the primary key?
A: It means that the data in each column in each row are dependent only on other columns that are part of the primary key.
Q: Can there be columns in a table that are not related to any column in the primary key?
A: Columns that are not related to any column in the primary key are removed.
Q: What is the function of a primary key in a table?
A: A primary key is one or more columns in a row that is used to identify and index that row of the table.
Q: How is a third normal form beneficial to database normalization?
A: Being in third normal form makes it easier to maintain and update the database, as well as reduce redundancy and improve consistency in the data.
Q: What is the relationship between second normal form and third normal form?
A: The first requirement for a table to be considered in third normal form is that it must already be in second normal form. Therefore, second normal form is a necessary requirement for a table to be in third normal form.
Related articles
Author
AlegsaOnline.com Third Normal Form (3NF) in Relational Database Design Leandro Alegsa
URL: https://en.alegsaonline.com/art/99400