union 은 세로로 데이터를 붙여주고, 중복값들을 없앤 데이터를 반환한다.

union all 은 중복 포함 전체를 보여준다.

SELECT*
From products
where price <=5
union
select * from products
where price >=200
-- 내가 푼 것....
select
case when f1.x <= f1.y then f1.x else f2.x end as x,
case when f2.x <= f2.y then f2.y else f1.y end as y
from (select x, y from functions where x != y) f1
join (select x, y from functions where x != y) f2 on f1.x = f2.y
union
select x, y from functions
where x=y
group by x
having count(x) > 1
order by x
-- 문제 풀이
select f1.x, f1.y from functions f1
join functions f2 on f1.x = f2.y and f1.y = f2.x
where f1.x < f1.y
union
select x, y from functions
where x=y
group by x
having count(x) > 1
order by x