Sort and Limit Recent Reservations
Your front desk team needs a quick snapshot of the latest hotel check-ins, so they can prepare for arrivals and manage room readiness.
You've been asked to extract the 5 most recent bookings from the system using the check-in date.
To complete this, you'll use the ORDER BY
clause to sort the data by check_in_date
, and the LIMIT
clause to keep only the most recent rows.
This type of query is common when building dashboards, reports, or quick-reference tools for operations.
What to Show
From the bookings
table in the hotel_booking.sqlite
database, display:
hotel_name
city
check_in_date
Only include the 5 most recent bookings, sorted by check_in_date
in descending order.
Instructions
Write a SQL query in the editor that returns the 5 latest bookings.
Use ORDER BY check_in_date DESC
to sort from newest to oldest, and add LIMIT 5
to keep only the most recent records.
Lecture
AI Tutor
Design
Upload
Notes
Favorites
Help
Code Editor
Tables
Execution Result