skip to main content
Supported SQL functionality : Select : Select clause : From clause : Limit clause
  

Try DataDirect Drivers Now
Limit clause

Purpose

Places an upper bound on the number of rows returned in the result.

Syntax

LIMIT number_of_rows [OFFSET offset_number]
where:
number_of_rows
specifies a maximum number of rows in the result. A negative number indicates no upper bound.
OFFSET
specifies how many rows to skip at the beginning of the result set. offset_number is the number of rows to skip.

Notes

*In a compound query, the Limit clause can appear only on the final Select statement. The limit is applied to the entire query, not to the individual Select statement to which it is attached.

Example

The following example returns a maximum of 20 rows.
SELECT last_name, first_name FROM emp WHERE salary > 20000 ORDER BY dept_idc LIMIT 20