Home >Database >Mysql Tutorial >How Does MySQL\'s LIMIT with OFFSET Control Row Retrieval?
LIMIT with OFFSET in MySQL: Rows Returned
MySQL's LIMIT and OFFSET clauses allow users to control the number of rows retrieved and the starting point for those rows. The following query:
SELECT column FROM table LIMIT 18 OFFSET 8
returns 18 rows from the specified table, starting from row number 9. OFFSET specifies the number of rows to skip before starting to retrieve results. In this case, it skips the first 8 rows. LIMIT then limits the number of rows returned from the remaining results to 18.
Hence, the query retrieves results from row 9 (OFFSET 1) to row 26 (OFFSET 18). The output will contain 18 rows starting from record number 9 and ending at record number 26.
Refer to the official MySQL documentation for more information on using LIMIT and OFFSET clauses effectively.
The above is the detailed content of How Does MySQL\'s LIMIT with OFFSET Control Row Retrieval?. For more information, please follow other related articles on the PHP Chinese website!