OFFSET tells the database to skip a specified number of rows before returning the remaining result set, usually together with a row-limiting clause.
OFFSET is important for pagination and for navigating through large query result sets.
Skip the first 20 employees and return the next 10.
SELECT
EmployeeID,
EmployeeName,
Salary
FROM Employees
ORDER BY EmployeeID
LIMIT 10 OFFSET 20;
OFFSET is commonly used in application pagination, reporting interfaces, and large result-set navigation.
- OFFSET skips rows.
- It is commonly used with LIMIT or FETCH.
- It supports pagination.
- ORDER BY should normally be used for predictable paging.
- Large OFFSET values can affect performance.
What does OFFSET do?
OFFSET skips a specified number of rows before returning query results.
Why is ORDER BY important with OFFSET?
ORDER BY provides a predictable row sequence so pagination returns consistent results.