Lecture

Sort and Limit Recent Reservations

Your front desk team needs a quick view of the latest hotel check-ins to prepare for arrivals and manage room readiness.

You’ve been asked to extract the five most recent bookings based on their check-in dates.

To do this, you’ll combine two SQL tools:

  • ORDER BY — sorts results by date
  • LIMIT — restricts how many rows are returned

This approach is often used in dashboards, daily reports, and operational summaries.


Task

From the bookings table in the hotel_booking.sqlite database, display:

  • hotel_name
  • city
  • check_in_date

Show only the five most recent bookings, sorted by check_in_date in descending order (newest first).


How to solve it

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.

sqlQuiz
?

Lecture

AI Tutor

Design

Upload

Notes

Favorites

Help

Code Editor

Run
Generate

Tables

Execution Result