UNION clause
The UNION
clause is used to combine the result of multiple queries.
#
Data SetThe following examples are executed with this data set. You can create this data set locally by executing the queries at the end of the page: Data Set.

#
1. Combine queries and retain duplicatesTo combine two or more queries and return their results without removing duplicates, use the UNION ALL
clause.
First, let's add a few existing nodes to the data set.
A query with the UNION ALL
clause could look like this:
Output:
#
2. Combine queries and remove duplicatesTo combine two or more queries and return their results without removing duplicates, use the UNION
clause without ALL
.
Output:
#
Data set QueriesWe encourage you to try out the examples by yourself. You can get our data set locally by executing the following query block.