SKIP

更新时间:
复制 MD 格式

SKIP defines from which record to start including the records in the output.

Introduction

By using SKIP , you can trim the result set from the top. Unordered results are returned unless you specify an order by using the ORDER BY clause. SKIP accepts any expression that evaluates to a positive integer.

Skip the first three rows

To return a subset of the result starting from the top, execute the following statement:

Example

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

The vertices are returned. The age property does not exist on the vertices.

   name   
----------
 "D"      
 "E"      
(2 rows)

Return the middle two rows

To return a subset of the result starting from somewhere in the middle, execute the following statement:

Example

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

Two vertices from the middle are returned.

   name   
----------
 "B"      
 "C"      
(2 rows)

Return a subset of rows using an expression with SKIP

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

Example

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

The first two vertices are skipped. Only the last three vertices are returned in the result.

   name    
----------
 "C"      
 "D"      
 "E"      
(3 rows)