INTERSECT
を使用する必要があります およびMINUS
(Oracleの場合):
-- At least at Boston or at Dallas
(SELECT DNAME
FROM DEPARTMENT
WHERE CITY = 'DALLAS'
UNION
SELECT DNAME
FROM DEPARTMENT
WHERE CITY = 'BOSTON')
MINUS
-- At Boston and at Dallas
(SELECT DNAME
FROM DEPARTMENT
WHERE CITY = 'DALLAS'
INTERSECT
SELECT DNAME
FROM DEPARTMENT
WHERE CITY = 'BOSTON')
UNION
以降 追加 EXCEPT
の間にサブクエリを実行します /MINUS
減算 それら