Middle
Have you ever had to normalize data in a database? Provide an example.
sobes.tech AI
Answer from AI
Yes, I had to normalize data in the database to eliminate redundancy and ensure integrity.
Example: There was an orders table that stored information about customers and their addresses along with orders. This led to duplication of customer data in each order record.
Normalization included:
- Creating a separate
Clientstable with a unique client ID and their data. - Keeping only a foreign key to the client in the
Orderstable.
This allowed:
- To avoid duplication of customer information.
- To facilitate updating customer data in one place.
- To improve the structure and performance of the database.