Summary
In this chapter, we explored using the WITH
, CASE
, FOREACH
, and UNWIND
clauses to build some advanced query patterns. We looked at chaining queries using the WITH
clause to introduce new variables to the next part of the query, reducing the scope of the variables, and performing some conditional query executions. We looked at using a CASE
expression to manipulate data to either write a graph or when returning a response. We looked at using the FOREACH
and UNWIND
clauses to iterate lists either to write a graph or to return data and discussed where graphs are appropriate to use and where not to use them. Finally, we looked at count stores, how we can leverage them in queries, and the optimal query patterns for counting the relationships of a single node.
In the next chapter, we will take a look at using the EXPLAIN
and PROFILE
keywords to identify query performance pain points and how to address them.