Use CASE WHEN inside aggregates to pivot rows into columns
I need a pivot table: one row per product category (normalized), with separate columns for 2023 revenue, 2024 revenue, and 2025 revenue. This is going into a slide deck so make it clean — four rows, four columns.
Each hint you reveal reduces the XP you can earn. Try the query first.
Use SUM(CASE WHEN year = 2023 THEN revenue ELSE 0 END) to create year-specific columns
Extract year from sale_date and normalize category with LOWER()
GROUP BY the normalized category