9.3. Limit

LIMIT enables the return of only subsets of the total result.

Figure 9.3. Graph

Return first part

To return a subset of the result, starting from the top, use this syntax:

Query. 

MATCH (n)
RETURN n
ORDER BY n.name
LIMIT 3

The top three items are returned by the example query.

Result

n
3 rows

Node[2]{name:"A"}

Node[3]{name:"B"}

Node[4]{name:"C"}

Try this query live. create (_0 {`name`:"D"}) create (_1 {`name`:"E"}) create (_2 {`name`:"A"}) create (_3 {`name`:"B"}) create (_4 {`name`:"C"}) create _2-[:`KNOWS`]->_1 create _2-[:`KNOWS`]->_0 create _2-[:`KNOWS`]->_4 create _2-[:`KNOWS`]->_3 match (n) return n order by n.name limit 3