SQL: normalization removes repeated facts
A flat table that mixes facts about several things repeats information. Here every row of an order repeats the customer's city. If the city changes, every row must be updated, and missing one leaves the data inconsistent. This is an update anomaly. Insert and delete anomalies are the same problem in other forms.
SQL
CREATE TABLE orders_flat (order_id INTEGER, customer TEXT, city TEXT, item TEXT);
INSERT INTO orders_flat VALUES (1, 'Ada', 'London', 'pen'), (1, 'Ada', 'London', 'book'), (2, 'Bo', 'Paris', 'pen');
CREATE TABLE customer (name TEXT PRIMARY KEY, city TEXT);
INSERT INTO customer SELECT DISTINCT customer, city FROM orders_flat;
CREATE TABLE order_item (order_id INTEGER, customer TEXT REFERENCES customer(name), item TEXT);
INSERT INTO order_item SELECT order_id, customer, item FROM orders_flat;
UPDATE customer SET city = 'Oxford' WHERE name = 'Ada';
SELECT i.order_id, c.name, c.city, i.item
FROM order_item i JOIN customer c ON c.name = i.customer
ORDER BY i.order_id, i.item;
SELECT (SELECT COUNT(*) FROM orders_flat WHERE customer = 'Ada') AS flat_copies,
(SELECT COUNT(*) FROM customer WHERE name = 'Ada') AS normalized_copies;