Limit Clause
- Last Updated: September 15, 2015
- 1 minute read
- DataDirect Connectors
- JDBC
- Apache Cassandra 6.0
- Documentation
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