Middle
What are normal forms in databases?
sobes.tech AI
Answer from AI
Normal forms are a set of rules and requirements for the structure of tables in relational databases, aimed at eliminating redundancy and anomalies during data updates.
The main normal forms:
- First Normal Form (1NF): all fields are atomic, meaning indivisible, and the table does not contain 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.
Example: if an orders table stores information about the customer as well, then changing customer data requires updates in multiple places — this is redundancy. Separating into orders and customers tables solves this problem.
Normalization improves data integrity and simplifies maintenance.