SQLQuokka
Start practicing
QuestionsLearnSandboxFeaturesRoadmapFAQ

Listing Booking Windows

Unsolved

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.

SQL Query Editor (Ctrl+Enter to run)
0 characters · Valid
Canonical Solution Official

Official Solution is Hidden

Try solving the question with the schema explorer and hints first. When ready, reveal the verified canonical query and step-by-step logic breakdown.

Community Q&A & Discussion

Ask questions, share alternate queries, and explore solutions

0 comments
Asked By:
🏢 Airbnb

Submission History

Your recent query executions and answer checks

Execution Pipeline:
FROM listings
Full source dataset
3 rows total
Ready. Type a query to see live execution.
Clause: Auto-Sync · AlaSQL Engine