I'm using Memgraph Lab for querying my graph database. Sometimes, I need to execute multiple Cypher queries in one go. How can I run multiple queries at once in the Memgraph Lab editor? When I run this:
MATCH (n:Person) WHERE n.name = 'Alice' RETURN n
MATCH (n:Person) WHERE n.age > 25 RETURN n
I get an error:
Query failed: MATCH can't be put after RETURN clause or after an update.
A delimiter for queries is ;
, when you specify multiple queries in the editor and separate them by ;
, Memgraph Lab will execute each of those queries serially and all in separated transactions. Just add the to the end of lines
MATCH (n:Person) WHERE n.name = 'Alice' RETURN n;
MATCH (n:Person) WHERE n.age > 25 RETURN n;