Listing Bookings Aggregation
Start Timer
0:00:00
Let’s say we have a table representing vacation bookings. Write a query that returns columns representing the total number of bookings in the last 90 days, last 365 days, and overall.
Note: You may assume that today is the 1st of January 2022.
Example:
Input:
bookings
table
Column | Type |
---|---|
reservation_id |
INTEGER |
guest_id |
INTEGER |
check_in_date |
DATE |
check_out_date |
DATE |
Output:
Column | Type |
---|---|
num_bookings_last90d |
INTEGER |
num_bookings_last365d |
INTEGER |
num_bookings_total |
INTEGER |
Recommended questions for you
Personalized based on your user activity, skill level, and preferences.
.
.
.
.
.
.
.
.
.
Comments