<집합>

UNION: 합집합

※ 열 구성이 같은 경우만 가능

※ 중복값 자동 제거

SELECT * FROM sample71_a
UNION ALL
SELECT * FROM sample71_b;

INTERSECT: 교집합

SELECT * FROM sample71_a
INTERSECT
SELECT * FROM sample71_b;

EXCEPT: 차집합

SELECT * FROM sample71_a
EXCEPT
SELECT * FROM sample71_b;

CROSS JOIN: 곱집합 (=교차결합)

join-image.png

SELECT * FROM sample71_a
CROSS JOIN
SELECT * FROM sample71_b;
SELECT * from 테이블명1, 테이블명2 // FROM구로도 가능

※ UNION은 세로로 합침, 결합은 가로로 합침

<내부결합 & 외부결합>