O'Reilly logo

Neo4j Cookbook by Ankur Goel

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required