Airbnb wants to identify the cities with the strongest recent search-to-booking conversion. Write a SQL query that calculates booking conversion by city for the 30-day period ending on September 16, 2026.
A booking counts toward a city only when it is associated with a search session for that city. Count distinct search sessions and distinct booked sessions, so multiple booking records for one session do not inflate conversion.
Output
- Return one row per city with at least one qualifying search session.
- Include
city_name, search_sessions, booked_sessions, and conversion_rate.
conversion_rate is booked sessions divided by search sessions, rounded to four decimal places.
- Sort by conversion rate descending, then city name ascending, and return the top three rows.
- Sessions and bookings outside the fixed 30-day period are excluded. Cities or sessions with NULL city or session identifiers do not contribute to the city results.