select distinct deptno from emp; -- 1,2,4,6
select deptno from dept; -- 1,2,3,4,5
emp - dept
select deptno from emp where deptno not in(select deptno from dept);
dept - emp
select deptno from dept where deptno not in (select deptno from emp);
emp와 dept를 합집합 한 내용을 emp와 교집합
-- 1) emp와 dept를 합집합
(select deptno from emp
union all
select deptno from dept)
intersect
select deptno from emp;