juniorSQL

What is ORDER BY and LIMIT?

Updated May 17, 2026

Short answer

ORDER BY sorts results and LIMIT restricts rows.

Deep explanation

ORDER BY arranges data; LIMIT controls number of returned rows.

Real-world example

Top 10 oldest users.

Common mistakes

  • Using LIMIT without ORDER BY gives inconsistent results.

Follow-up questions

  • Can LIMIT be combined with OFFSET?
  • Does ORDER BY affect performance?

More SQL interview questions

View all →