LIMIT Without ORDER BY Gives You Arbitrary Rows, Not the First Ones
SQL guarantees no row order unless you ask for one, so LIMIT 10 without ORDER BY means any ten rows the engine happened to produce first. The same query can return different rows tomorrow simply because the plan changed or rows moved on disk. This matters most for paging: two pages fetched with LIMIT and OFFSET but no total order can show you the same row twice and skip another entirely.
Questions this Concept answers
- Why can paging with `LIMIT` and `OFFSET` show a user the same row twice when no total order is specified?
Sorting and Trimming SQL Results with ORDER BY LIMIT and OFFSET to Get the Top N Rows
ORDER BY, LIMIT, and OFFSET are the SQL clauses that sort a result set and trim it to a top-N slice. The governing principle is that a relational result set is an unordered set: without an explicit O…