Search code examples
memgraphdb

How can I find nodes with specific properties?


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 population for one city.


Solution

  • There are several ways to do this, first method is with WHERE clause:

    MATCH (c:City)
    WHERE c.name = "London"
    RETURN c.population_size;
    

    and second one is without:

    MATCH (c:City {name: "London"})
    RETURN c.population_size;
    

    The result will be the same.