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

You need a single 'orders per status' row using conditional aggregation, counting how many orders are in each status. Which expression correctly counts only 'shipped' orders?

-- counting shipped orders in a pivot column -- Option A COUNT(CASE WHEN status = 'shipped' THEN 1 END) -- Option B COUNT(CASE WHEN status = 'shipped' THEN 1 ELSE 0 END) -- Option C SUM(status = 'shipped') -- Option D COUNT(status = 'shipped')