Home >Database >Mysql Tutorial >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!