Interview › Pivot

SQL interview: rows to columns (PIVOT / CASE)

Wide reports are either PIVOT or a handful of SUM(CASE). Interviewers accept both. CASE is easier to read.

Prompt. One row per customer, columns for Shipped, Cancelled, Processing sales.

Hint: SUM(CASE WHEN status = … THEN amount ELSE 0 END)

Dynamic statuses: /tools/pivot. Do not concatenate user text into PIVOT IN.

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free