- 集合操作
WITH a AS ( SELECT 1 id
UNION
SELECT 2
),
b AS ( SELECT 1 id
UNION
SELECT 3
)
SELECT *
FROM a
EXCEPT
SELECT *
FROM b;
WITH a AS ( SELECT 1 id
UNION
SELECT 2
),
b AS ( SELECT 1 id
UNION
SELECT 3
)
SELECT *
FROM a
INTERSECT
SELECT *
FROM b
WITH a AS ( SELECT 1 id
UNION
SELECT 2
),
b AS ( SELECT 1 id
UNION
SELECT 3
)
SELECT *
FROM a
EXCEPT
SELECT *
FROM b;
WITH a AS ( SELECT 1 id
UNION
SELECT 2
),
b AS ( SELECT 1 id
UNION
SELECT 3
)
SELECT *
FROM a
INTERSECT
SELECT *
FROM b