Write a SQL query using window functions to find the second-highest sales volume day for each warehouse at Zebra Technologies.
Use the warehouses and sales tables. Treat the second-highest volume as the second distinct daily total, and include tied days at that level.
warehouse_id, warehouse_name, sale_date, and sales_volume.warehouse_id and sale_date.| Column | Type | Description |
|---|---|---|
| warehouse_idPK | INTEGER | Unique warehouse identifier |
| warehouse_name | VARCHAR(100) | Warehouse name |
| region | VARCHAR(50) | Operational region for the warehouse |
| Column | Type | Description |
|---|---|---|
| sale_idPK | INTEGER | Unique sales record identifier |
| warehouse_id | INTEGER | Warehouse associated with the sale |
| sale_date | DATE | Date on which the sale occurred |
| units_sold | INTEGER | Number of units sold in the record |