'Order of execution for PostgreSQL when UNION and INTERSECT are used
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!
Solution 1:[1]
Left to right but INTERSECT binds more tightly than UNION:
(A UNION (B INTERSECT C)) UNION D
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 |
