Home >Database >Mysql Tutorial >How Can I Retrieve All Rows After a Specific Offset in MySQL?
Accessing Data Beyond a Specific Row in MySQL
MySQL queries often require retrieving data starting from a particular row. While the LIMIT
clause normally specifies both a starting offset and a row count, obtaining all rows after a given offset presents a slight challenge. The LIMIT
clause necessitates both parameters.
The MySQL documentation offers a straightforward solution: use a very large number for the second (limit) parameter. This effectively retrieves all rows from the specified offset to the end of the result set.
For instance, to retrieve all rows from the 96th row onwards, use this query:
<code class="language-sql">SELECT * FROM tbl LIMIT 95, 18446744073709551615;</code>
Here, 95 represents the offset (starting from the 96th row, since it's zero-indexed), and 18446744073709551615
is the maximum value for a 64-bit unsigned integer, ensuring retrieval of all remaining rows.
The above is the detailed content of How Can I Retrieve All Rows After a Specific Offset in MySQL?. For more information, please follow other related articles on the PHP Chinese website!