Airbnb's host dashboard shows three booking counts per listing. Treat 2025-07-01 as today. A booking is in the last 90 days when DATEDIFF('2025-07-01', booked_on) is at most 90, and in the last 365 days when it is at most 365. All bookings are dated before today. Every listing must appear, including listings with no bookings. Write an SQL query that returns listing_id, listing_name, bookings_last_90_days, bookings_last_365_days and total_bookings. Order the results by listing_id ascending.
Loading…
Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.
Ask questions, share alternate queries, and explore solutions
Your recent query executions and answer checks
This will insert the verified MySQL solution into your editor so you can study how each clause transforms the table.