๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ

๐Ÿ“ ์•Œ๊ณ ๋ฆฌ์ฆ˜/Programmers

[MySQL/PGS] Lv.3 : ์—…๊ทธ๋ ˆ์ด๋“œ ํ•  ์ˆ˜ ์—†๋Š” ์•„์ดํ…œ ๊ตฌํ•˜๊ธฐ

728x90
๋ฐ˜์‘ํ˜•

https://school.programmers.co.kr/learn/courses/30/lessons/273712

 

ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค

SW๊ฐœ๋ฐœ์ž๋ฅผ ์œ„ํ•œ ํ‰๊ฐ€, ๊ต์œก, ์ฑ„์šฉ๊นŒ์ง€ Total Solution์„ ์ œ๊ณตํ•˜๋Š” ๊ฐœ๋ฐœ์ž ์„ฑ์žฅ์„ ์œ„ํ•œ ๋ฒ ์ด์Šค์บ ํ”„

programmers.co.kr

 


ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค ๋ ˆ๋ฒจ 3.

์–ผ๋งˆ์ „์— ์ฝ”ํ…Œ์—์„œ null ๊ด€๋ จ ํ•จ์ˆ˜๊ฐ€ ์•ˆ ๋– ์˜ฌ๋ผ์„œ ๊ทธ ๋ฌธ์ œ๋ฅผ ๋†“์ณค๋Š”๋ฐ..

๊ทธ๊ฒŒ ํ•œ์ด ๋˜์–ด์„œ ์ด ๋ฌธ์ œ๋ฅผ ํ’€๊ฒŒ ๋˜์—ˆ๋‹ค ๐Ÿ˜ข

 

is not null์„ ์„œ๋ธŒ์ฟผ๋ฆฌ๋ฅผ ์“ธ ๋•Œ ์กฐ๊ฑด์œผ๋กœ ์‚ฌ์šฉํ•ด์ค˜์•ผ ํ•œ๋‹ค.

๋ฉ”์ธ์ฟผ๋ฆฌ์— ์“ฐ๋ฉด ํ‹€๋ฆผ..ใ…‹ใ…Ž

not in์œผ๋กœ ๋น„๊ตํ•ด์ค„ ใ„ธใ… ํ™•์‹คํ•˜๊ฒŒ ๊ฑธ๋Ÿฌ์˜จ ๊ฐ’๋งŒ ๋น„๊ตํ•˜๊ธฐ!

 

 

๋‚˜์˜ ํ’€์ด

select I.ITEM_ID, I.ITEM_NAME, I.RARITY
from ITEM_INFO I, ITEM_TREE T
where I.ITEM_ID = T.ITEM_ID and T.ITEM_ID not in 
            (select PARENT_ITEM_ID 
             from ITEM_TREE
             where PARENT_ITEM_ID is not null)
order by I.ITEM_ID desc;

728x90
๋ฐ˜์‘ํ˜•