SKIP

The SKIP clause specifies the number of initial rows to omit from the output.

Introduction

SKIP trims the result set from the top. Note that result order is not guaranteed unless explicitly specified by an ORDER BY clause. SKIP accepts any expression that evaluates to a non-negative integer.

Skipping the First Three Rows

To return a subset of results starting after the first N rows, use the following syntax:

Query

SELECT *
FROM cypher('graph_name', $$
    MATCH (n)
    RETURN n.name
    ORDER BY n.name
    SKIP 3
$$) AS (names agtype);

Returns results after skipping the first three rows.

Result

names
"D"
"E"
2 rows

Returning Two Rows from the Middle

To return a subset starting at an arbitrary position, combine SKIP with LIMIT.

Query

SELECT *
FROM cypher('graph_name', $$
    MATCH (n)
    RETURN n.name
    ORDER BY n.name
    SKIP 1
    LIMIT 2
$$) AS (names agtype);

Returns two vertices from the middle of the ordered result set.

Result

names
"B"
"C"
2 rows

Using Expressions with SKIP

Expressions may be used with SKIP to dynamically determine how many rows to skip.

Query

SELECT *
FROM cypher('graph_name', $$
    MATCH (n)
    RETURN n.name
    ORDER BY n.name
    SKIP (3 * rand()) + 1
$$) AS (a agtype);

Skips the first two vertices and returns the last three.

Result

names
"C"
"D"
"E"
3 rows