Your question is Pivot Open Issues by Store. Start with the requirements and the one table on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Instacart operations wants a quick store-level summary of currently open shopper support issues. Write a SQL query to pivot issue counts by store.
store_name for records where issue_status = 'open'.total_open_issues.late_pick as late_pick_issuesout_of_stock as out_of_stock_issuessubstitution_needed as substitution_needed_issuestotal_open_issues descending, then store_name ascending.| Column | Type | Description |
|---|---|---|
| issue_idPK | INT | Unique issue record ID |
| store_name | VARCHAR(100) | Instacart partner store name |
| issue_type | VARCHAR(50) | Type of picker issue |
| issue_status | VARCHAR(20) | Current issue status |
| reported_date | DATE | Date the issue was reported |
| affected_orders | INT | Number of orders affected |