db.l3.ai

Play

lessons

what-changed-in-19

editor

engine: not started

results

Run a query to see rows here.

check

Order of operations

INTERSECT binds tighter than UNION and EXCEPT. UNION and EXCEPT share a level and go left to right. Parentheses override both.

task

SELECT 1 UNION SELECT 2 INTERSECT SELECT 2 returns 1 and 2, because the INTERSECT runs first. Add parentheses so the UNION runs first and the query returns only 2.

hints