Most databases allow parenthese around set operations to control evaluation order:
SELECT 1
INTERSECT
(
SELECT 1
EXCEPT
SELECT 1
)
In SQLite, the above is a syntax error. As a result, we currently omit parentheses around set operations altogether (code), leading to data corruption in some cases.
However, SQLite does support simply wrapping the nested set operation in a SELECT:
SELECT 1
INTERSECT
SELECT * FROM (
SELECT 1
EXCEPT
SELECT 1
)