Junior — Middle
Can you explain the concept of database normalization and its main forms?
sobes.tech AI
Answer from AI
Database normalization is the process of organizing data in tables to reduce redundancy and ensure data integrity. The main goal is to minimize duplication and avoid anomalies during data insertion, updating, or deletion.
Main forms of normalization:
- First Normal Form (1NF): all table fields contain atomic (indivisible) values, with no repeating groups.
- Second Normal Form (2NF): the table is in 1NF, and all non-key fields 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 fields (i.e., non-key fields do not depend on each other).
Example: if you have a table with orders that also stores customer information, normalization would move the customer data to a separate table to avoid duplicating it for each order.