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

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?

This question is related to mysql

The answer is


OFFSET is nothing but a keyword to indicate starting cursor in table

SELECT column FROM table LIMIT 18 OFFSET 8 -- fetch 18 records, begin with record 9 (OFFSET 8)

you would get the same result form

SELECT column FROM table LIMIT 8, 18

visual representation (R is one record in the table in some order)

 OFFSET        LIMIT          rest of the table
 __||__   _______||_______   __||__
/      \ /                \ /
RRRRRRRR RRRRRRRRRRRRRRRRRR RRRR...
         \________________/
                 ||
             your result

You will get output from column value 9 to 26 as you have mentioned OFFSET as 8