Database Reference
In-Depth Information
Working with the OPTIONAL MATCH clause
The OPTIONAL MATCH clause is similar to MATCH but the only difference is that
OPTIONAL MATCH is "not strict" while evaluating the pattern against a given dataset.
In MATCH , it is all or nothing but OPTIONAL MATCH uses NULLs for missing parts of the
pattern for those scenarios where no match is found. It is similar to the functionality
provided by the outer joins in SQL.
Let's consider that in the movie dataset, we want to get all outgoing relationships from the
movie Rocky II . The following is our Cypher query:
OPTIONAL MATCH (n:Movies {Title: "Rocky II"})-[r]->()
return r;
The result is shown in the following screenshot:
The preceding query returned 1 row and the <null> values because there were no
matching records for the given pattern.
Search WWH ::




Custom Search