Overview
The SKIP
statement allows you to discard a specified number of records from the start of the current working table. A non-negative integer must be specified in SKIP
.
OFFSET
can be used as a synonym toSKIP
.
<skip statement> ::= "SKIP" <non-negative integer>
Example Graph
The following examples run against this graph:
To create this graph, run the following query against an empty graph:
INSERT (p1:Paper {_id:'P1', title:'Efficient Graph Search', score:6, author:'Alex'}),
(p2:Paper {_id:'P2', title:'Optimizing Queries', score:9, author:'Alex'}),
(p3:Paper {_id:'P3', title:'Path Patterns', score:7, author:'Zack'}),
(p1)-[:Cites {weight:2}]->(p2),
(p2)-[:Cites {weight:1}]->(p3)
Skipping N Records
MATCH (n:Paper)
RETURN n.title SKIP 1
Result:
n.title |
---|
Efficient Graph Search |
Path Patterns |
Skipping N Ordered Records
MATCH (n:Paper)
ORDER BY n.score
SKIP 1
MATCH p = (n)->()
RETURN p
Result:
p |
---|
(:Paper {_id: "P2", score: 9, title: "Optimizing Queries", author: "Alex"})-[:Cites {weight: 1}]->(:Paper {_id: "P3", score: 7, title: "Path Patterns", author: "Zack"}) |