Database normalization: reduce redundancy and update anomalies
Database normalization is the process of arranging data into relations and rules so that repeated facts do not cause inconsistencies or insertion, update, and deletion problems. It does not mean simply creating more tables. First identify functional dependencies and candidate keys from the business rules, then choose decompositions that preserve the information and constraints the design needs.
What can go wrong when everything is stored in one table?
Suppose each shipment row repeats supplier and supplier-city details. If the business rule is “each supplier operates from one city,” then supplier_id → city is a functional dependency. When a supplier ships several parts, the same fact is repeated in the table.
| Supplier ID | Part ID | City | Quantity |
|---|---|---|---|
| S-17 | P-04 | Busan | 80 |
| S-17 | P-09 | Busan | 25 |
| S-31 | P-04 | Daejeon | 40 |
Under the stated assumptions, (supplier_id, part_id) may be a candidate key for this relation. If supplier S-17 moves, every one of its rows must be updated. Missing one row records two cities for the same supplier. It may also be difficult to record a supplier's city before the first shipment, or deleting its last shipment may erase the supplier information. These are update, insertion, and deletion anomalies. They tend to appear when one fact must be maintained in several places.
Functional dependencies and keys provide the design rules
A functional dependency X → Y means that in any two rows of the same relation, equal X values must imply equal Y values. For example, if a supplier ID uniquely determines a supplier, then supplier_id → supplier_name, city holds. This is not a pattern that happens to appear in the current sample data; it must be a rule that always holds in the domain. Several suppliers can be in one city, and names may not be unique, so a stable ID may identify a supplier better than its name or city.
A superkey is a set of attributes that uniquely identifies a row; a candidate key is a minimal superkey. Attributes that appear in a candidate key are called prime attributes. Looking only at one chosen primary key may not be enough: account for alternate candidate keys and composite keys too. Identifying the actual domain dependencies is the most important input to normalization. If they are guessed incorrectly, a schema can appear to meet a normal form while still allowing real anomalies. University of Wollongong CSCI235 database normalization notes
What do 1NF, 2NF, and 3NF check?
Normal forms are successive design checks. The commonly taught 1NF, 2NF, and 3NF concern value domains and dependencies on keys. “Atomic” in 1NF does not mean indivisible in an absolute sense. It means defining a single value appropriate to the domain and how the application uses it. For example, do not pack several independently searchable phone numbers into one comma-separated cell; model them as separate rows. A list in one value or repeated phone1, phone2 columns makes it harder to constrain and join each number independently.
Second normal form (2NF) requires a relation to be in 1NF and every nonprime attribute to be fully functionally dependent on every candidate key. For a composite candidate key, it rules out a dependency on only part of that key. Consider an enrollment relation (student_id, course_id, grade, student_name, course_name) with (student_id, course_id) → grade, student_id → student_name, and course_id → course_name. The names depend on only part of the composite key, so repeating them for every enrollment is unnecessary. Separating students, courses, and enrollments puts each fact with the appropriate key. If all candidate keys are single attributes, partial dependency cannot occur, so this particular check is satisfied automatically.
Third normal form (3NF) restricts nonprime attributes from depending on a key indirectly through another nonkey attribute. Formally, for every nontrivial functional dependency X → A, X must be a superkey or A must be a prime attribute. If supplier_id → company_name and company_name → city, then supplier_id → city follows through company name. Copying the company city into every shipment makes it difficult to keep all rows consistent when the company's city changes. Moving that dependency to a separate company relation is a typical 3NF motivation. Memorizing only “remove transitive dependencies” can miss cases with alternate candidate keys, so the formal condition is useful too. These definitions and examples should be checked against a relation schema and its dependencies, not merely against its current rows. BCcampus, Database Design, 3rd ed., Chapter 7: Redundancy, Functional Dependencies, Closure, and Normalization
How can you check a decomposition?
For the shipment relation, assume the business rules supplier_id → city and (supplier_id, part_id) → quantity. The key is (supplier_id, part_id). Because city depends on only part of that key, supplier facts can be separated from supplier-part relationships:
CREATE TABLE supplier (
supplier_id text PRIMARY KEY,
city text NOT NULL
);
CREATE TABLE supplier_part (
supplier_id text NOT NULL REFERENCES supplier(supplier_id),
part_id text NOT NULL,
quantity integer NOT NULL CHECK (quantity >= 0),
PRIMARY KEY (supplier_id, part_id)
);This schema stores a supplier's city once in its supplier row. The foreign key requires a supplier-part row to reference an existing supplier; the composite primary key prevents duplicate rows for the same supplier and part. The SQL is illustrative and was not executed. A real design must first decide whether city means the supplier's current location or a delivery destination, whether a supplier can have multiple sites, and whether quantity is a cumulative figure or a shipment event. Those rules change the keys and tables.
Check two properties when deciding whether a decomposition is sound:
**Lossless join:** joining the decomposed relations should recover the original facts without inventing combinations that were not present.
**Dependency preservation:** important functional dependencies should, where possible, be checkable through keys and constraints on the decomposed relations. A dependency that is not preserved may need a cross-table check or an application-level guarantee.
This does not mean dependency preservation must always win over a stronger normal form. It means evaluating losslessness, where rules can be enforced, and query requirements together. Compare representative rows before and after decomposition, and identify which primary-key, foreign-key, unique, or check constraints enforce each rule. PostgreSQL's documentation describes these schema-level mechanisms. PostgreSQL 18: Data Definition and Constraints
How far should you normalize: 3NF or BCNF?
Boyce–Codd normal form (BCNF) is stricter: for every nontrivial dependency X → A, X must be a superkey. 3NF allows an exception when A is prime; BCNF does not. Decomposing to BCNF can reduce more redundancy, but some dependencies may no longer be enforceable using each decomposed table alone. For example, a relation may have both city, street → zipcode and zipcode → city. It can satisfy 3NF but not BCNF. Splitting it can reduce repeated zipcode-city pairs, yet the rule that a city-and-street combination determines the zipcode may no longer be enforceable by a constraint on one table. University of Wollongong notes on 3NF, BCNF, and decomposition
In practice, first make the business rules enforceable and the data coherent. Many designs start with 3NF and consider BCNF or higher forms when additional functional or multivalued dependencies cause a real problem. Deliberate denormalization for read performance is also an option, but it needs a defined source of truth, synchronization responsibility, conflict handling, and rebuild procedure. Neither “more normalization is always better” nor “normalization is slow because it adds joins” is a justified universal conclusion. Do not state performance claims as facts without measurement; decide using the actual read and write patterns.
A schema review checklist
Define what real-world fact each attribute represents and the domain of its values.
Derive functional dependencies and all candidate keys from business rules; do not infer them from a small sample alone.
Check for attributes that depend on only part of a composite key and for dependencies through nonkey attributes.
Verify that decompositions are lossless and preserve the dependencies the design must enforce.
Decide which rules belong in primary-key, foreign-key, unique, and check constraints.
Review which joins and writes common reads and updates will require after decomposition.
If you denormalize, document the source of truth, synchronization method, failure recovery, and rebuild process.
Normalization is a way to identify rules and place data so those rules are harder to violate. The goal is not to maximize the name of the normal form; it is to explain where each fact is maintained and which constraints keep it consistent.
Scope and sources
[University of Wollongong CSCI235: Database Normalization lecture notes](https://documents.uow.edu.au/~jrg/235/slides/03databasenormalization/03databasenormalization.html)
[BCcampus, *Database Design*, 3rd ed., Chapter 7: Redundancy, Functional Dependencies, Closure, and Normalization](https://pressbooks.bccampus.ca/nelson/chapter/chapter07thirdedition/)
[PostgreSQL 18 documentation: Data Definition](https://www.postgresql.org/docs/18/ddl.html)
Sources were checked on 2026-11-22. Normal-form definitions and decomposition theory apply to the relational model. The supplier rules and SQL are illustrative assumptions; the SQL was not executed.