Topic 7.6
Normalization
In one line
Split data by dependency to kill redundancy and update anomalies: 1NF, 2NF, 3NF.
Think of it like this
Keeping one master copy of each piece of information instead of writing it in ten different notebooks. If a customer changes their phone number, you update it in ONE place instead of hunting down every notebook where it was copied.
Key ideas
- 01
1NF: no repeating groups — one value per cell; arrays become child tables.
- 02
2NF: no partial dependency — non-key columns depend on the WHOLE composite key.
- 03
3NF: no transitive dependency — non-key columns depend only on the key (not on other non-key columns).
- 04
The win: no duplicate truth → impossible to update one copy and miss the other.
- 05
The cost: more tables, more joins — which is why prod rarely stops at 3NF for hot paths.
- 06
Interview answer: 'I normalize for correctness, then denormalize deliberately for read throughput' — a complete sentence.
Java / Spring map
- →
JPA entities in 3NF by default; @Embeddable for 1NF violations you keep for practicality.
Code & diagrams
Explain without notes
Show a 2NF violation with a composite-key table (order_id, product_id, product_price)? Actually — is product_price a 2NF violation? Say why or why not.
Practice
Normalize a flat 'booking' CSV into 3NF tables and note each anomaly you removed.
Trade-offs
- ↔
Every normal form is a trade against join cost; 3NF is the sweet spot to START, not a hard finish.
Completion checklist
I can drive any schema from 1NF to 3NF and name the anomaly each step kills.