SQLite LIMIT Clause
The LIMIT Clause
The LIMIT clause sets the maximum number of records to return. It is useful in big tables, where you only want to see a few records.
This example selects the first three customers:
Skip Records With OFFSET
OFFSET skips a number of records before the result starts. This example skips the first three customers, and returns the next three:
This is useful when you show a long list one page at a time.
Note: You can also write LIMIT 3, 3. Then the first number is the offset, and the second number is the limit. LIMIT 3 OFFSET 3 is easier to read.
LIMIT With ORDER BY
Together with ORDER BY, LIMIT gives you a top list. This example selects the five most expensive products:
LIMIT With WHERE
Write LIMIT after WHERE. This example selects the first three customers from Germany: