Combine CASE WHEN with multi-table JOINs and multiple aggregation levels
For the revenue review, I need every sale classified by deal size: 'Small' if revenue < 100, 'Medium' if 100-500, 'Large' if 500-2000, and 'Enterprise' if over 2000. Show the deal size bucket, number of transactions, total revenue, and average revenue per deal. Sort by total revenue descending.
Each hint you reveal reduces the XP you can earn. Try the query first.
Use CASE WHEN on the revenue column to create deal size buckets
GROUP BY the CASE WHEN expression and compute COUNT(*), SUM(revenue), AVG(revenue)
Use ROUND on the average for cleaner output