Write a query to find the average trip duration for guests who booked their first trip in the last 30 days on Turo.
Use the guests and trips tables. Treat a guest's earliest booking timestamp as their first trip, and calculate the average duration of those qualifying first trips. Use the database's current date for the 30-day window.
average_trip_duration_hours.| Column | Type | Description |
|---|---|---|
| guest_idPK | INT | Unique identifier for a Turo guest |
| guest_name | VARCHAR(100) | Guest display name |
| account_status | VARCHAR(20) | Current guest account status |
| Column | Type | Description |
|---|---|---|
| trip_idPK | INT | Unique identifier for a trip |
| guest_id | INT | Guest who booked the trip |
| booked_at | TIMESTAMP | Timestamp when the trip was booked |
| trip_start | TIMESTAMP | Trip start timestamp |
| trip_end | TIMESTAMP | Trip end timestamp |