MySQL’s LIMIT clause provides a convenient way to limit the number of results returned by a query. However, this clause requires specifying both the limit number and the offset, which makes it difficult to obtain an unlimited number of offset data. Can we get around this limitation?
As stated in the MySQL manual, to retrieve all rows from a specific offset to the end of the result set, you can use a very large number as the second value of the LIMIT parameter. By setting the limit to 18446744073709551615 (the maximum value for a 64-bit integer), you can effectively offset an unlimited number of rows.
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>
Using this method, you can retrieve an unlimited amount of offset data without modifying MySQL configuration or relying on third-party tools.
The above is the detailed content of How Can I Fetch Data From an Arbitrary Offset to the End in MySQL?. For more information, please follow other related articles on the PHP Chinese website!