SKIP

1. Introduction

By using SKIP, the result set will get trimmed from the top. Please note that no guarantees are made on the order of the result unless the query specifies the ORDER BY clause. SKIP accepts any expression that evaluates to a positive integer — however the expression cannot refer to nodes or relationships.

Diagram

2. Skip first three rows

To return a subset of the result, starting from the fourth result, use the following syntax:

Query
MATCH (n)
RETURN n.name
ORDER BY n.name
SKIP 3

The first three nodes are skipped, and only the last two are returned in the result.

Table 1. Result
n.name

"D"

"E"

2 rows

3. Return middle two rows

To return a subset of the result, starting from somewhere in the middle, use this syntax:

Query
MATCH (n)
RETURN n.name
ORDER BY n.name
SKIP 1
LIMIT 2

Two nodes from the middle are returned.

Table 2. Result
n.name

"B"

"C"

2 rows

4. Using an expression with SKIP to return a subset of the rows

Skip accepts any expression that evaluates to a positive integer as long as it is not referring to any external variables:

Query
MATCH (n)
RETURN n.name
ORDER BY n.name
SKIP toInteger(3*rand())+ 1

The first three nodes are skipped, and only the last two are returned in the result.

Table 3. Result
n.name

"C"

"D"

"E"

3 rows