Sequence of fulfillment of UNION, EXCEPT, and INTERSECT operators
When solving exercise #6 (SELECT) of the rating stage we had to answer the question of precedence of UNION, EXCEPT, and INTERSECT operations. Martin Gruber  in his “SQL Instant Reference” suggests the following logical sequence of their fulfillment:
If we presume that the logical sequence of fulfillment of operations corresponds to their precedence, than the precedence of UNION and EXCEPT operations is identical and, as a result, they should be fulfilled in accordance with the sequence in which they are recorded, and this sequence is not changed by placement of the brackets. Thereby both of the operations are fulfilled before INTERSECT operation, i.e. they have precedence over it.
Let’s analyze three simple queries, which we will combine in different ways in order to prove the aforementioned claims:
Let’s prove the first claim. If EXCEPT operation has precedence over UNION operation, then the queriesand
should give us different results. However it is not so and we obtain the same resulting set:
Similarly, if UNION operation has precedence over EXCEPT operation, then the queries
Thus, UNION and EXCEPT operations are equivalent in terms of precedence.
Let’s check precedence of INTERSECT operation as compared to other statements (in test problems one can choose any of them, as both of them have the same sequence).
If INTERSECT is inferior in precedence or equivalent to UNION, then the queriesand
should give identical results. However we obtain different result sets. The first query gives the result
Conclusion. Logical sequence, suggested in the beginning of the article, does not correspond to the order of precedence of the operations, and, to my mind, it should be reversed: