TASK #180 · Medium · Booking.comAverage 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.
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.
Ctrl / ⌘ + ↵
Result
Write a query and run it to see the results.
Schema
propertiesproperty_id, name, city, country, property_type, starsbookingsbooking_id, property_id, user_id, check_in, check_out, total_price, status