Bunch of weird stuff about sql. Explain each function, method, etc. Basics for python, what is def, how to write a loop, etc.
For this SQL exercise, write one query that summarizes qualifying customer orders and demonstrates common PostgreSQL query functions.
Output
- One row per customer, including customers without qualifying orders.
- Return
customer_id, customer_name, order_count, total_spend, avg_order_value, categories, customer_tier, and revenue_rank.
- Include completed or pending orders from 2024-01-01 through 2024-03-31, exclude cancelled orders, and order by
revenue_rank, then customer_id.