LIMIT clause MySql
The LIMIT qualifier enables you to choose how many rows to return in a query, and where in the table to start returning them. When passed a single parameter, it tells MySQL to start at the beginning of the results and just return the number of rows given in that parameter. If you pass it two parameters, the first indicates the offset from the start of the results where MySQL should start the display, and the second indicates
how many to return. You can think of the first parameter as saying, “Skip this number of results at the start.”
Following Example includes three commands. The first returns the first three rows from the table. The second returns two rows starting at position 1 (skipping the first row). The last command returns a single row starting at position 3 (skipping the first three rows).
SELECT author,title FROM classics LIMIT 3; SELECT author,title FROM classics LIMIT 1,2; SELECT author,title FROM classics LIMIT 3,1;
Be careful with the LIMIT keyword, because offsets start at zero, but the number of rows to return starts at 1. So LIMIT 1,3 means return three rows starting from the second row.