Limit and Offset

suggest change

limit sets how many rows to return. offset sets how many rows to skip first. Without an order, the database does not promise which rows those are.

For example:

User.limit(3) # up to three rows

That generates:

SELECT  `users`.* FROM `users` LIMIT 3

With no offset, the query starts at the beginning of that unordered result.

User.limit(5).offset(30) # 5 rows after skipping 30, rows 31 through 35 only if an order is set

That generates:

SELECT  `users`.* FROM `users` LIMIT 5 OFFSET 30

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents