OFFSET clause

OFFSET clause

OFFSET expression

The OFFSET clause specifies a number of objects to be skipped. If a LIMIT clause is also present, the OFFSET is applied prior to the LIMIT. The OFFSET value must be a non-negative integer.

The OFFSET clause optionally follows the LIMIT clause. If an offset is specified, the specified number of objects is omitted from the result set before enforcing a specified LIMIT. This clause must be a non-negative integer.

Examples

The following examples show the LIMIT and OFFSET clauses.

Name and age list: limit and offset by 2

SELECT fname, age
     FROM tutorial
          ORDER BY age
              LIMIT 2 OFFSET 2  
  

Returns:


{
   "results": [
     {
       "age": 40,
       "fname": "Jane"
     },
     {
       "age": 46,
       "fname": "Dave"
     }
   ]
 } 
  

Golf products list: limit and offset by 10

SELECT *
 FROM product
      UNNEST product.categories AS cat
         WHERE LOWER(cat) IN ["golf"] LIMIT 10 OFFSET 10