Create a database schema for a small e-commerce.
Use a normalized design for customers, products, and orders, including primary keys, foreign keys, suitable data types, and order totals. Then provide a query that validates the design by summarizing customer purchasing activity.
Output
- One row per customer, including customers without orders
- Columns:
customer_name, order_count, distinct_products, total_spent, and last_order_date
- Include all customers, treat missing totals as zero, and sort by
total_spent descending, then customer_id ascending