Middle
What is normalization and denormalization of databases?
sobes.tech AI
Answer from AI
Database normalization is the process of organizing data in tables to minimize redundancy and ensure data integrity. It typically involves splitting large tables into smaller ones and establishing relationships between them through keys. This helps prevent data duplication and update anomalies.
Denormalization is the reverse process, where data is combined or duplicated to improve read performance, reducing the number of table joins. Denormalization can increase query speed but leads to redundancy and complicates data updates.
Example:
- Normalized structure: separate tables for customers, orders, and products, linked by keys.
- Denormalized structure: an orders table where customer information is duplicated for quick access.
The choice between normalization and denormalization depends on performance requirements and data integrity.