Home >Database >Mysql Tutorial >How Can I Retrieve All Rows from a Specific Offset in MySQL?

How Can I Retrieve All Rows from a Specific Offset in MySQL?

Patricia Arquette
Patricia ArquetteOriginal
2025-01-17 09:36:10224browse

How Can I Retrieve All Rows from a Specific Offset in MySQL?

Fetching All Rows After an Offset in MySQL

This article tackles the problem of selecting all rows from a MySQL table starting at a particular row number. The standard LIMIT clause in MySQL requires both a starting offset and a row count, creating a challenge when needing all rows after a specific point.

Solution: Using a Large Limit Value

The MySQL documentation for LIMIT indicates that to retrieve all rows from a given offset onwards, a very large number can be specified as the upper limit. For example, to get all rows starting from the 96th row:

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

This approach uses a sufficiently large number (the maximum value for an unsigned BIGINT) as the second LIMIT parameter, effectively retrieving all rows after the offset.

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

Statement:
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