Limiting and skipping results with Cypher

The Cypher, by default, returns all the results that match a particular query. However, many times we require a limited number of results or just the topmost result. This can easily be done via LIMIT and SKIP, specified with the query. In this recipe, we will learn the use of LIMIT and SKIP, along with the Cypher query.

Getting ready

To work through this recipe, you will need to create the nodes and relationships for which data has been provided with the code files.

How to do it...

We have divided this recipe into the following problem sets:

  • Limiting the results: Let's get the delay times of the topmost three delayed flights, along with the flight number and reason of delay:
    MATCH (f)-[r:DELAYED_BY]->(x) RETURN ...

Get Neo4j Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.