Your question is SQL: 90th Percentile by Metro. 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.
Instacart Operations needs to compare delivery performance across metros. Write a PostgreSQL query that calculates the 90th percentile delivery duration for each metro area.
delivered_at and pickup_at.metro_areas and return one row per metro with at least one valid delivery.| Column | Type | Description |
|---|---|---|
| delivery_idPK | INTEGER | Unique delivery identifier |
| metro_id | INTEGER | References metro_areas.metro_id |
| pickup_at | TIMESTAMPTZ | Shopper pickup timestamp |
| delivered_at | TIMESTAMPTZ | Customer delivery timestamp |
| Column | Type | Description |
|---|---|---|
| metro_idPK | INTEGER | Unique metro identifier |
| metro_name | VARCHAR(100) | Instacart metro name |