Given a table of user transactions and a table of delivery logs, write a query to identify the average delivery time for first-time buyers at Meta Logistics. Treat the earliest transaction for each user as their first purchase and include only transactions with a recorded delivery timestamp.
average_delivery_time_minutes.| Column | Type | Description |
|---|---|---|
| transaction_idPK | INT | Unique transaction identifier |
| user_id | INT | Identifier of the purchasing user |
| transaction_at | TIMESTAMP | Timestamp when the transaction was placed |
| amount | NUMERIC(10,2) | Transaction amount |
| Column | Type | Description |
|---|---|---|
| delivery_log_idPK | INT | Unique delivery log identifier |
| transaction_id | INT | Transaction associated with the delivery |
| delivered_at | TIMESTAMP | Timestamp when the delivery was completed |