union (중복값을 제거해준다.) && union all

select *
from Products 
where price <= 5

union or union all // oracle - intercept, minus, except

select *
from Products
where price >= 200

---
// 고객정보는 있지만 주문정보는 없을 때 + 주문정보는 있지만 고객정보는 없을 때 
select * 
from Customers
		left join Orders on Customers.CustomerID = Orders.CustomerID

union 
		
select *
from Customers
		right join Orders on Customers.CustomerID = Orders.CustomerID
		

---

select x, y
from functions
where x = y
group by x, y
having count(*) = 2

union 

select f1.x, f1.y
from functions as f1
    inner join functions as f2 on f1.x = f2.y and f1.y = f2.x
where f1.x < f1.y
order by x // 위의 쿼리에 order 을 사용할 수 없고 order by x 는 전체 테이블에 적용된다.