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
Release: 2025-01-17 09:36:10
Original
223 people have browsed it

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>
Copy after login

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!

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