์ ์์ ๊ฐ ๊ธฐ๋ก(ANIMAL_OUTS)์ ์๋๋ฐ, ๋ณดํธ์์ ๋ค์ด์จ ๊ธฐ๋ก(ANIMAL_INS)์ด ์๋ ๋๋ฌผ์ Table A๋ฅผ ANIMAL_OUTS, Table B๋ฅผ ANIMAL_INS๋ผ๊ณ ํ ๋, LEFT EXCLUSIVE JOIN์ ํด๋นํ๋ค.
LEFT EXCLUSIVE JOIN์ ๋ค์๊ณผ ๊ฐ๋ค.
SELECT [Select List]
FROM TableA A
LEFT OUTER JOIN TableB B
ON A.key = B.key
WHERE B.key IS NULL;
์์์ ANIMAL_ID, NAME์ ์กฐํํ๋๋ฐ
LEFT OUTER JOIN์์ ANIMAL_ID ์ค์์ B์๋ ์๋ ANIMAL_ID๋ฅผ ์กฐํํ๋ค.
SELECT A.ANIMAL_ID, A.NAME
FROM ANIMAL_OUTS A
LEFT OUTER JOIN ANIMAL_INS B
ON A.ANIMAL_ID = B.ANIMAL_ID
WHERE B.ANIMAL_ID IS NULL;
[ํ๋ก๊ทธ๋๋จธ์ค] ์ค๋ ๊ธฐ๊ฐ ๋ณดํธํ ๋๋ฌผ(1) (SQL/JOIN) (0) | 2021.01.30 |
---|---|
[ํ๋ก๊ทธ๋๋จธ์ค] ์์๋๋ฐ์ ์์์ต๋๋ค (SQL/JOIN) (0) | 2021.01.23 |
[HackerRank] Weather Observation Station 4 (SQL) (0) | 2021.01.14 |
[ํ๋ก๊ทธ๋๋จธ์ค] NULL ์ฒ๋ฆฌํ๊ธฐ (SQL/IS NULL) (0) | 2021.01.11 |
[ํ๋ก๊ทธ๋๋จธ์ค] ์ด๋ฆ์ด ์๋ ๋๋ฌผ์ ์์ด๋ (SQL/IS NULL) (0) | 2021.01.11 |