Limit and Offset
suggest changelimit 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
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents