Junior — Middle
Can you explain the concept of normal forms in relational databases?
sobes.tech AI
Answer from AI
Normal forms are a set of rules for organizing data in relational databases to minimize redundancy and avoid update anomalies.
- First Normal Form (1NF): all table fields must contain atomic (indivisible) values, with no repeating groups.
- Second Normal Form (2NF): the table must be in 1NF, and all non-key attributes must depend on the entire composite key (if the key is composite).
- Third Normal Form (3NF): the table must be in 2NF, and all non-key attributes must not depend on each other (no transitive dependency).
For example, if a table contains order and customer data, it is better to split it into two tables — one for orders and another for customers — to avoid duplicating customer information in each order.