Skip to main content
Practice

8

sql

-- Sort books by checkout date (newest first)
SELECT book_title, checkout_date
FROM book_checkouts
ORDER BY checkout_date DESC;

-- Show top 2 most recent checkouts
SELECT book_title, checkout_date
FROM book_checkouts
ORDER BY checkout_date DESC
LIMIT 2;

-- Show books with the earliest checkout dates
SELECT book_title, checkout_date
FROM book_checkouts
ORDER BY checkout_date ASC;

Want to learn more?

Join CodeFriends Plus membership or enroll in a course to start your journey.