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

What will this pivot query produce in the 'electronics' column for a month that had no electronics sales but did have other sales?

SELECT month, COALESCE(SUM(CASE WHEN category='electronics' THEN amount END), 0) AS electronics FROM sales GROUP BY month;