This repository was archived by the owner on Oct 10, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +100
-16
lines changed
src/content/docs/cypher/query-clauses Expand file tree Collapse file tree 2 files changed +100
-16
lines changed Original file line number Diff line number Diff line change @@ -18,17 +18,58 @@ LIMIT 3;
1818```
1919Result:
2020```
21- -----------
22- | u.name |
23- -----------
24- | Zhang |
25- -----------
26- | Karissa |
27- -----------
28- | Adam |
29- -----------
21+ ┌─────────┐
22+ │ u.name │
23+ │ STRING │
24+ ├─────────┤
25+ │ Zhang │
26+ │ Karissa │
27+ │ Adam │
28+ └─────────┘
3029```
3130
3231If you omit the ` ORDER BY ` , you would get some k tuples in a ` LIMIT k ` query
3332but you have no guarantee about which ones will be selected.
3433
34+
35+ The number of rows to limit can either be:
36+ 1 . A parameter expression when used with prepared statement:
37+
38+ Prepare:
39+ ``` c++
40+ auto prepared = conn->prepare ("MATCH (u: User ) RETURN u.name limit $lt")
41+ ```
42+ Execution:
43+ The number of rows to limit can be given at the time of execution.
44+ ```c++
45+ conn->execute(prepared.get(), std::make_pair(std::string{"lt"}, 1))
46+ ```
47+
48+ Result:
49+ ```
50+ ┌────────┐
51+ │ u.name │
52+ │ STRING │
53+ ├────────┤
54+ │ Adam │
55+ └────────┘
56+ ```
57+ 2 . A literal expression which can be evaluated at compile time.
58+ ``` cypher
59+ MATCH (u:User)
60+ RETURN u.name
61+ limit 1+2
62+ ```
63+ Result:
64+
65+ ```
66+ ┌─────────┐
67+ │ u.name │
68+ │ STRING │
69+ ├─────────┤
70+ │ Adam │
71+ │ Karissa │
72+ │ Zhang │
73+ └─────────┘
74+ ```
75+
Original file line number Diff line number Diff line change @@ -20,14 +20,57 @@ SKIP 2;
2020```
2121Result:
2222```
23- -----------
24- | u.name |
25- -----------
26- | Karissa |
27- -----------
28- | Zhang |
29- -----------
23+ ┌─────────┐
24+ │ u.name │
25+ │ STRING │
26+ ├─────────┤
27+ │ Karissa │
28+ │ Zhang │
29+ └─────────┘
3030```
3131
3232If you omit the ` ORDER BY ` , you would skip some k tuples in a ` SKIP ` k query
3333but you have no guarantee about which ones will be skipped.
34+
35+
36+ The number of rows to skip can either be:
37+ 1 . A parameter expression when used with prepared statement:
38+
39+ Prepare:
40+ ``` c++
41+ auto prepared = conn->prepare ("MATCH (u: User ) RETURN u.name skip $sp")
42+ ```
43+
44+ Execution:
45+
46+ The number of rows to skip can be given at the time of execution.
47+ ```c++
48+ conn->execute(prepared.get(), std::make_pair(std::string{"sp"}, 2))
49+ ```
50+
51+ Result:
52+ ```
53+ ┌────────┐
54+ │ u.name │
55+ │ STRING │
56+ ├────────┤
57+ │ Zhang │
58+ │ Noura │
59+ └────────┘
60+ ```
61+ 2 . A literal expression which can be evaluated at compile time.
62+ ``` cypher
63+ MATCH (u:User)
64+ RETURN u.name
65+ skip 2+1
66+ ```
67+ Result:
68+
69+ ```
70+ ┌────────┐
71+ │ u.name │
72+ │ STRING │
73+ ├────────┤
74+ │ Noura │
75+ └────────┘
76+ ```
You can’t perform that action at this time.
0 commit comments