Which rows are returned when using LIMIT with OFFSET in MySQL?

Arun Killu picture Arun Killu · Apr 12, 2012 · Viewed 130.1k times · Source

In the query below:

SELECT column 
FROM table
LIMIT 18 OFFSET 8

how many results will we get as output and from where to where?

Answer

Mosty Mostacho picture Mosty Mostacho · Apr 12, 2012

It will return 18 results starting on record #9 and finishing on record #26.

Start by reading the query from offset. First you offset by 8, which means you skip the first 8 results of the query. Then you limit by 18. Which means you consider records 9, 10, 11, 12, 13, 14, 15, 16....24, 25, 26 which are a total of 18 records.

Check this out.

And also the official documentation.