概述
SKIP
语句可从工作表的开头丢弃指定数量的记录。必须在SKIP
中指定一个非负整数。
OFFSET
可作为SKIP
的同义词使用。
<skip statement> ::= "SKIP" <non-negative integer>
示例图

CREATE GRAPH myGraph {
NODE Paper ({title string, score uint32, author string}),
EDGE Cites ()-[]->()
} PARTITION BY HASH(Crc32) SHARDS [1]
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]->(p2),
(p2)-[:Cites]->(p3)
跳过N条记录
MATCH (n:Paper)
RETURN n.title SKIP 1
结果:
n.title |
---|
Efficient Graph Search |
Path Patterns |
排序后跳过N条
MATCH (n:Paper)
ORDER BY n.score
SKIP 1
MATCH p = (n)->()
RETURN p
结果:p
