Your question is Second-Highest Warehouse Transaction Volume. Start with the requirements and the two tables 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.
Find the warehouse with the second-highest total posted transaction volume. Sum quantity by warehouse using only rows where status = 'posted', and return the warehouse name with its total volume. If multiple warehouses tie for second place, return all of them.
| Column | Type | Description |
|---|---|---|
| warehouse_id | ||
| warehouse_name | ||
| region_code |
| Column | Type | Description |
|---|---|---|
| transaction_id | ||
| warehouse_id | ||
| transaction_date | ||
| quantity | ||
| status |
| 3 | Dallas Hub | SOUTH |
| 1 | Phoenix DC | WEST |
| 5 | Reno Overflow | WEST |
| 104 | 2 | 2024-02-03 | 90 | posted |
| 101 | 1 | 2024-02-01 | 120 | posted |
| 110 | 5 | 2024-02-05 | 50 | posted |