Composed queries
UNION
and WHEN
enable the composition of multiple separate query branches within a single query.
UNION
allows for combining the results of different queries, while WHEN
enables conditional queries, where different query branches can be made to execute depending on a set of criteria.
As such, UNION
and WHEN
manage in different ways the execution flow and logic of queries and cannot be used in queries as regular clauses.
For more information, see:
-
Conditional queries (
WHEN
) Introduced in Neo4j 2025.03