I am trying to build a query string that involves the use of multiple UNION and INTERSECT clauses on PostgresSQL/google-BigQuery. I want to understand the order in which each of the select statements will get executed in the following case.
A UNION B INTERSECT C UNION D
(((A UNION B) INTERSECT C) UNION D)
(A UNION (B INTERSECT (C UNION D)))
Will it be right-to-left or left-to-right or something different?
Thanks in advance!
CodePudding user response:
Left to right but INTERSECT
binds more tightly than UNION
:
(A UNION (B INTERSECT C)) UNION D