Search code examples
memgraphdb

How can I find nodes with specific values that are in specific range?


How can I find nodes with specific properties using a Cypher query language? I have a list of cities. List contains city names and population. I need to print out names of all cities that have population between two defined values.


Solution

  • To match nodes with properties in a range use the following code:

    MATCH (c:City)
    WHERE c.population_size >= 1000000 AND c.population_size <= 2000000
    RETURN c;