Lesson 4 of 7
ORDER BY and LIMIT: sort and cap
ORDER BY column sorts the results (ASC by default, DESC for descending); LIMIT n keeps only the first n rows.
It's the ranking duo: "top 10", "5 most recent"…
SELECT name FROM customers ORDER BY age DESC LIMIT 2;
🎯 Exercise
Write the query that returns the name of the 2 oldest customers (sorted by age descending, then LIMIT).
PRO lesson
This advanced chapter is part of CodeAge PRO. Unlock it to keep your adventure going.
Discover PRO →