pk조건
select count(*) 건수, count(distinct 강의코드) 유일한건수
from dbo
select *
from dbo
where [pk로 할 칼럼] is null
inner join = join
select *
from consumer
select *
from product
select a.name, b.p_name, b.pp
from consumer a join product b
on a.id = b.consumer_id
left join
select a.name, b.p_name, b.pp
from consumer a left join product b
on a.id = b.consumer_id
Union
- 위의 쿼리 결과와 아래의 쿼리 결과를 합친 행(중복제거)
Union All
- 위의 쿼리 결과와 아래 쿼리 결과를 합친 행(중복제거 없음)
Intersect(교집합)
- 위의 쿼리 결과와 아래 쿼리 결과에서 공통된 행(중복제거)
Except(차집합)
- 위의 쿼리 결과와 애래 쿼리 결과 공통부분을 빼고 남은 행(중복제거, 순서중요)
- 위의 쿼리가 밑의 쿼리를 포함하고 있으면 0개로 나온다.