Your question is SQL for Operational Performance. Start with the requirements and the three 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.
Carvana Operations Managers need a location-level view of market operations performance. Write a PostgreSQL query using Carvana market locations, completed orders, and recorded order errors.
Use 2025-02-15 as the reporting date, and analyze completed orders whose completed_at falls within the preceding 30 days, including both boundary dates.
0.00 when a location has no completed orders.| Column | Type | Description |
|---|---|---|
| location_idPK | INTEGER | Unique market location identifier |
| location_name | VARCHAR(100) | Carvana market location name |
| Column | Type | Description |
|---|---|---|
| order_idPK | INTEGER | Unique order identifier |
| location_id | INTEGER | Market location handling the order |
| status | VARCHAR(20) | Current order status |
| created_at | DATE | Date the order was created |
| completed_at | DATE | Date the order was completed |
| cycle_time_minutes | INTEGER | Operational cycle time in minutes |
| Column | Type | Description |
|---|---|---|
| error_idPK | INTEGER | Unique error record identifier |
| order_id | INTEGER | Order associated with the error |
| error_type | VARCHAR(50) | Operational error category |