Your question is 7-Day Rolling Average Bookings. 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.
Navan wants to monitor booking trends across countries in Navan Travel. Write a PostgreSQL query that calculates a seven-day rolling average of confirmed daily bookings for each active country from January 1 through January 10, 2024.
status = 'confirmed' and a valid country in countries.| Column | Type | Description |
|---|---|---|
| country_idPK | INTEGER | Unique country identifier |
| country_code | VARCHAR(2) | Two-letter country code |
| country_name | VARCHAR(100) | Country display name |
| Column | Type | Description |
|---|---|---|
| booking_idPK | INTEGER | Unique booking identifier |
| country_id | INTEGER | Country associated with the booking |
| booking_date | DATE | Date on which the booking was created |
| status | VARCHAR(20) | Booking lifecycle status |