Aggregate revenue by year and quarter using date extraction
Hey — board deck is due Friday and I need a clean revenue table: year, quarter, total revenue. Three years of data, 2023 through 2025. Can you pull this from fact_sales? The CEO wants to see the trend at a glance.
Each hint you reveal reduces the XP you can earn. Try the query first.
Use EXTRACT(YEAR FROM sale_date::date) to get the year from a text date column
Use EXTRACT(QUARTER FROM sale_date::date) for the quarter number (1–4)
GROUP BY both year and quarter, then ORDER BY year, quarter to make it readable