concept Data & storage
Database normalization and update anomalies
When orders store separate copies of a customer’s current email, changing just one leaves conflicting addresses. Storing the email once under the customer ID lets every order reference the same current value.
What it means
If two orders each store a customer’s current email, an address change has to reach both rows. Update just one, and the answer to “What is this customer’s email?” depends on which order you read. That is an update anomaly. The problem is not that two values look alike; it is that two places must agree about one fact. Microsoft’s normalization guidance describes separating a dependent fact from the rows that repeat it.
The rule in this example is customerID → current email: at any given time, rows with the same customer ID must agree on the current email. This is a functional dependency, and the customer ID is its determinant. The rule allows the address to change over time; it does not allow two different current addresses for the same ID at the same time. Berkeley’s database design notes give the definition in terms of agreement on the determinant and the dependent value.
Try it
In the synthetic example, orders O1 and O2 both reference customer C1. Both start with old@example.test. Keep Declared functional dependency at customer ID → current email and New synthetic customer email at new@example.test. Compare the choices under Fact-update arrangement:
Database normalization and update anomalies
Edit one synthetic repeated fact, show the inconsistent views, then compare a small decomposed schema with explicit keys and dependencies.
Synthetic inputs only. This is not a measurement of your hardware or service.
Repeated copies of the same declared fact can diverge when only one copy is updated.
One customer fact, two order views
- Views agree on the declared current fact
- No
- Synthetic fact writes
- 1
- Other customer unchanged
- other@example.test
| Order | Customer | Current email view |
|---|---|---|
| O1 | C1 | new@example.test |
| O2 | C1 | old@example.test |
Evaluated evidence
- Fact-update arrangement
- one-repeated
- New synthetic customer email
- new@example.test
- Declared functional dependency
- customer-to-email
The fixture models a current customer fact, not a historical email snapshot per order. Normalization does not guarantee faster queries or remove the need for constraints and transactions.
About this model
Every input is local synthetic evidence. Numbers stay as raw text until this model validates them. The shown evaluated values come from the same result as the explanation.
Presets replace the entire scenario. Reset restores all starting fields, scenario selection and model state; it does not change the open or closed state of this help or article FAQ.
No external request, device command, stored-input history or measurement is performed.
- `one-repeated` (default): One write changes the email stored in
O1tonew@example.test.O2still saysold@example.test. Each order still namesC1, but the two order views now disagree aboutC1’s current email. - `all-repeated`: Two writes, one to each copy, leave both orders showing
new@example.test. Repetition doesn’t make disagreement inevitable; it makes agreement depend on reaching every copy. - `decomposed` (the “Store the customer fact once” preset): The email is stored in one customer row, not in either order. One write changes
C1’s customer row tonew@example.test. Neither order’s customer reference changes, so both order views now obtain the new email from that same row.
Choose Inspect the evidence boundary to set the dependency to Unknown / evidence unavailable. The result is unknown, not a finding that the schema is wrong: two matching addresses in the starting rows cannot establish what the addresses are supposed to mean.
Use only synthetic addresses. An input such as not-an-email or real@example.com is invalid; the simulation does not compute an update for it. Reset restores the default scenario and all three starting inputs, returns the step and virtual time to zero, and clears errors, history, and comparison.
In practice
Before splitting a table, finish this sentence: “This email is the address for whom, and as of when?” If it means the customer’s current email, use a Customer table keyed by customerID for that value. Keep orderID as the key of Order, with customerID referencing Customer. Check that each order still identifies exactly one customer row: that is how you recover the intended order-and-current-email information without keeping a second copy. Preserving the intended information matters when you decompose a relation. Berkeley’s database design notes distinguish this requirement from simply splitting columns into tables.
If the order instead records the email used when the order was placed, changing today’s customer row should not rewrite yesterday’s order. Replacing that snapshot with a lookup of the current email would lose the historical fact, even if the two addresses happen to match today.
The write counts above are synthetic fact writes, not query timings. Normalization does not guarantee faster queries or replace constraints and transactions; measure performance separately for the workload you care about. Choose where to store a fact by its meaning and its declared determinant, not by a coincidence in a few rows.
Frequently asked questions
Editorial questions based on the listed sources and explicitly labeled local examples.
What makes an update anomaly?
In the fixture, CustomerID determines email, but the same customer’s email is copied into two order rows. Changing only one row leaves inconsistent representations of that one fact.
Are repeated values always a design error?
No. The dependency and purpose matter. A historical value intentionally captured on an order may represent a different fact; the example’s anomaly relies on the stated current-customer-email dependency.
Where do functional dependencies come from?
They are supplied domain rules, not something this model proves from a few coincidentally equal rows. When the assumed customer-to-email dependency is unknown, the decomposition conclusion is left unproved.
Does normalization always make queries faster?
No performance result is calculated. The sample illustrates consistency and ownership of a fact; it does not measure query plans, join cost or the tradeoffs of a particular workload.
Sources & model boundaries
Primary references used for this explanation. The interactive example is an educational model, not a live check.
- Description of database normalization basics
Eliminate repeating data; dependent facts. Repeating a fact in many rows creates update-consistency work; moving a dependent fact to its appropriate keyed table separates ownership.
Checked .
- CS186 Note13: Database Design
Functional dependencies and lossless decomposition. A functional dependency requires equal determinant values to imply equal dependent values; a valid decomposition must preserve the intended information.
Checked .