Pivot rows to columns in SQL: conditional aggregation versus a PIVOT operator, and the limits of dynamic pivoting
Role: Data Scientist
Category: Data Manipulation (SQL/Python)
Difficulty: medium
Interview Round: Other
Overview: Asks how to turn rows into columns in SQL with conditional aggregation and how that compares with a vendor PIVOT operator. Tests portability, NULL handling for missing combinations, why a query's output columns must be known up front, and how dynamic pivoting works when categories change.