Problem Statement
Explain how normalization up to 3NF helps prevent insert, update, and delete anomalies. Give a short example.
Explanation
In 1NF you store atomic values, so lists do not cause duplication or parsing. In 2NF you remove partial dependency on part of a composite key, which stops unrelated attributes from repeating across rows. In 3NF you remove transitive dependencies so non-keys depend only on the key.
For example, storing customer_city in the orders table causes update anomalies if the city changes. Moving customer attributes to the customers table and referencing it by a foreign key keeps one source of truth and avoids inconsistent edits.
Code Solution
SolutionRead Only
CREATE TABLE customers(id PK, name, city); CREATE TABLE orders(id PK, customer_id FK REFERENCES customers(id));
Practice Sets
This question appears in the following practice sets:
