Composite query statements
A composite query statement combines a list of linear query statements with query conjunctions. The query conjunctions could be UNION
, EXCEPT
, INTERSECT
, or OTHERWISE
.
Here’s the syntax of the composite query:
<query> <conjunction> <query>
Here are the definitions within the syntax:
<query>
: Represents any linear query statement or another composite query.<conjunction>
: Represents conjunction keywords such asUNION
,EXCEPT
,INTERSECT
, andOTHERWISE
. You will explore this later in this section.- The two
<query>
instances of the composite query must return variables with the same variable names.
Next, you will explore the usage of the UNION
conjunction.
Retrieving union records
The GQL UNION
conjunction merges results from two queries sharing the same returning variable name. UNION
supports both UNION ALL
and UNION [DISTINCT]
, allowing for the retention of all results...