Notice
Recent Posts
Recent Comments
Link
«   2025/07   »
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31
Tags
more
Archives
Today
Total
관리 메뉴

TMI개발일기

OuterJoin(아우터 조인) 본문

SQL

OuterJoin(아우터 조인)

JP59 2021. 5. 6. 10:57

inner join은 두테이블의 join의 기준점이 되는 column의 데이터가 같은
경우에만 조회 되지만
outer join은 left or right 기준 테이블은 다 조회되고 만약 join 기준 column
데이터가 다르면 null로 표시된다.

 

벤다이어그램으로 나눠 보면 이런 모양이다.

 

사실 예제로 보고 직접 해보는게 이해하는데 더 도움이 된다.

 

wishlist 테이블

 

 

client 테이블

 

 

client와 wishlist의 outer join(left)

select * from client C left outer join wishlist W on C.client_no = W.client_no;

 

client와 wishlist의 outer join(right)


select * from client C right outer join wishlist W on C.client_no = W.client_no;

 

client와 wishlist의 outer join(full)


select * from client C full outer join wishlist W on C.client_no = W.client_no;

'SQL' 카테고리의 다른 글

Inner Join( 이너 조인)  (0) 2021.04.19
foreign key(외래키)  (0) 2021.04.19
Top n Query(탑 n 쿼리)  (0) 2021.04.19
Sub Query(서브 쿼리)  (0) 2021.04.19
Select(조회)-1  (0) 2021.04.10