RienSQL
TASK #180 · Medium · Booking.com

Average Length of Stay per Property Type

Your brief
The length of stay of a booking in nights is the difference between check_out and check_in. Consider only completed bookings (status = 'completed').

Write a query that returns property_type and avg_nights (the average length of stay in nights, rounded to two decimals). Sort by avg_nights descending.
Expected columnsproperty_type avg_nightsBooking.com
SQL editor
SQLite
Ctrl / ⌘ + ↵
Result

Write a query and run it to see the results.

Schema
propertiesproperty_id, name, city, country, property_type, stars
bookingsbooking_id, property_id, user_id, check_in, check_out, total_price, status