Use CASE WHEN to bucket continuous values into categories and aggregate by bucket
Finance is questioning our discount strategy. Can you bucket all sales into discount tiers — 'No Discount' for 0 or NULL, 'Low' for up to 10%, 'Medium' for 10-20%, and 'High' for over 20%? I need the tier name, number of sales, and total revenue for each tier. Sort by revenue descending.
Each hint you reveal reduces the XP you can earn. Try the query first.
Use CASE WHEN to create discount tiers: check for NULL or 0 first, then ranges
Remember that NULL discount and 0 discount are different values but belong in the same business tier here
GROUP BY the CASE WHEN expression (or alias) to aggregate per tier