What is the importance of normalization in database design?
Use the normalized tables provided to demonstrate how related entities can be combined without storing repeated customer or order data. Write a query that summarizes customer purchasing activity.
Output
- One row per customer, including customers with no orders
- Columns:
customer_id, customer_name, order_count, and total_spent
- Count each order once and treat customers without line items as having zero spending
- Order by
customer_id ascending
Output details
- Count orders even when they have no line items.
- Format
total_spent with precision numeric(12, 2), displaying exactly two decimal places.