Junior — Middle
Can you explain the principles of data normalization in databases and their types?
sobes.tech AI
Answer from AI
Data normalization is the process of organizing data in a database to minimize redundancy and avoid anomalies during data update, insertion, and deletion. The main goal is to improve data integrity and storage efficiency.
Main types of normal forms:
- First Normal Form (1NF) — all fields contain atomic (indivisible) values, no repeating groups.
- Second Normal Form (2NF) — the table is in 1NF, and all non-key attributes depend fully on the entire composite key (if the key is composite).
- Third Normal Form (3NF) — the table is in 2NF, and there are no transitive dependencies between non-key attributes.
There are more advanced forms (BCNF, 4NF, 5NF) that address more complex dependencies.
Example: if you have a table with orders, which stores both customer information and order details, normalization involves splitting into two tables — Customers and Orders, to avoid duplicating customer data with each order.