Skip to content

Latest commit

 

History

History
51 lines (35 loc) · 994 Bytes

oql-limit-clause.md

File metadata and controls

51 lines (35 loc) · 994 Bytes
title url tags
OQL Limit Clause
/refguide9/oql-limit-clause/
studio pro

1 Description

With the LIMIT clause a portion of the result of a query can be returned.

2 Syntax

The syntax is as follows:

[ LIMIT number ] [ OFFSET number ]

2.1 LIMIT

LIMIT specifies how many rows must be returned.

2.2 OFFSET

OFFSET specifies how many rows must be skipped before returning the result rows.

3 Examples

This query retrieves the first ten customers, sorted by their last name:

SELECT FirstName FROM Sales.Customer
ORDER BY LastName
LIMIT 10

This query retrieves all customers, except the first ten, sorted by their last name:

SELECT FirstName FROM Sales.Customer
ORDER BY LastName
OFFSET 10

This query retrieves the 11th to 20th customer, sorted by their last name:

SELECT FirstName FROM Sales.Customer
ORDER BY LastName
LIMIT 10 OFFSET 10