Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumSQLpivot conditional aggregationSingle-choice MCQ

What is the output structure of this conditional-aggregation pivot query?

SELECT region, SUM(CASE WHEN quarter = 'Q1' THEN amount ELSE 0 END) AS q1_sales, SUM(CASE WHEN quarter = 'Q2' THEN amount ELSE 0 END) AS q2_sales FROM sales GROUP BY region;