Describe the concept of data normalization and its purpose.

Instruction: Explain what data normalization is and why it's used in database design.

Context: This question tests the candidate's understanding of data normalization principles and their application in reducing data redundancy and improving data integrity.

Updated

Official answer

Relational normalization organizes attributes around keys and functional dependencies to reduce avoidable update, insertion and deletion anomalies. It is different from scaling numeric features for machine learning. Normalization does not remove every repeated value or automatically make every query faster.

Suppose each order row repeats customer_id and the customer's current name. If customer_id determines that name, store customers(customer_id, name) separately and reference it from orders(order_id, customer_id, placed_at). Use order_lines(order_id, line_number, product_id, quantity, unit_price) for repeated purchase lines. A historical sale price belongs to the line; replacing it with a product's current price would change history.

First normal form excludes repeating groups in the chosen relational design. Second normal form removes partial dependencies of non-prime attributes on a proper subset of a candidate key. Third normal form requires each nontrivial dependency X→A to have X as a superkey or A as a prime attribute. Use the actual candidate keys and business dependencies rather than mechanically splitting every column.

Check that decomposition is lossless and consider dependency preservation. Enforce intended uniqueness and foreign keys; normalization alone does not validate a factual name or authorize a user. Joins and access patterns can add cost, so measured denormalization may be appropriate for reporting, with a defined refresh and consistency policy.

Related Questions