Home > Database > Mysql Tutorial > How to Retrieve All Records After a Specific Offset in MySQL?

How to Retrieve All Records After a Specific Offset in MySQL?

Barbara Streisand
Release: 2025-01-17 09:27:11
Original
479 people have browsed it

How to Retrieve All Records After a Specific Offset in MySQL?

MySQL: Retrieve all records from specified offset

In MySQL, the LIMIT clause allows you to specify a limit and offset to extract a subset of rows from a table. However, common situations require retrieving an undetermined number of rows starting at a specific offset.

Solution: Use a large limit value

MySQL’s LIMIT clause manual provides a solution for this scenario. To offset rows from the beginning of the table without specifying a limit, use a large number as the second argument to the LIMIT clause. For example, the following query retrieves all rows from row 96 to the end of the result set:

<code class="language-sql">SELECT * FROM tbl LIMIT 95, 18446744073709551615;</code>
Copy after login

This value (18446744073709551615) is the maximum value of a 64-bit signed integer, which effectively means "unlimited".

The above is the detailed content of How to Retrieve All Records After a Specific Offset in MySQL?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template