Your question is SQL for Weekly Operational Metrics. 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.
eBay Operations needs a weekly view of order fulfillment performance across its marketplace operations. Write a PostgreSQL query that combines orders, shipment records, and eBay customer support tickets without double-counting orders that have multiple tickets.
| Column | Type | Description |
|---|---|---|
| order_idPK | INT | Unique eBay order identifier |
| buyer_id | VARCHAR(20) | eBay buyer identifier |
| order_date | DATE | Date the order was placed |
| promised_date | DATE | Promised delivery date |
| order_amount | NUMERIC(10,2) | Order value in dollars |
| order_status | VARCHAR(20) | Order lifecycle status |
| Column | Type | Description |
|---|---|---|
| shipment_idPK | INT | Unique shipment identifier |
| order_id | INT | Order associated with the shipment |
| shipped_date | DATE | Date the shipment left the fulfillment facility |
| delivered_date | DATE | Date delivered to the buyer |
| shipment_status | VARCHAR(20) | Shipment status |
| carrier | VARCHAR(30) | Shipping carrier |
| Column | Type | Description |
|---|---|---|
| ticket_idPK | INT | Unique support ticket identifier |
| order_id | INT | Order referenced by the ticket |
| created_at | TIMESTAMP | Ticket creation timestamp |
| resolution_status | VARCHAR(20) | Ticket resolution status |
| issue_type | VARCHAR(30) | Customer-reported issue category |