Advanced Query Patterns
In the last chapter, we looked at working with lists and maps. In this chapter, we will explore some advanced query patterns using Cypher clauses. We will discuss query chaining using the WITH
clause, iterate lists to modify the graph using the FOREACH
and UNWIND
clauses, and leverage count stores for building optimal queries. We will also take a look at simulating if condition using the FOREACH
clause. We will take a deeper look at these clauses and discuss how they can help us in building more advanced and complex queries.
In this chapter, we will be covering the following aspects:
- Working with the
WITH
clause - Working with the
CASE
clause - Working with the
FOREACH
clause - Working with the
UNWIND
clause - Working with count stores
First, we will start by exploring the WITH
clause. This is a very powerful paradigm that helps us build complex and performant queries with ease.