๐Ÿ’ SQL (Programmers)/Sum, Max, Min

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][SQL] ์กฐ๊ฑด์— ๋งž๋Š” ์•„์ดํ…œ๋“ค์˜ ๊ฐ€๊ฒฉ์˜ ์ดํ•ฉ ๊ตฌํ•˜๊ธฐ

์„ ๋‹ฌ 2024. 9. 23. 18:55
๋ฐ˜์‘ํ˜•

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

 

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

์ฝ”๋“œ ์ค‘์‹ฌ์˜ ๊ฐœ๋ฐœ์ž ์ฑ„์šฉ. ์Šคํƒ ๊ธฐ๋ฐ˜์˜ ํฌ์ง€์…˜ ๋งค์นญ. ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค์˜ ๊ฐœ๋ฐœ์ž ๋งž์ถคํ˜• ํ”„๋กœํ•„์„ ๋“ฑ๋กํ•˜๊ณ , ๋‚˜์™€ ๊ธฐ์ˆ  ๊ถํ•ฉ์ด ์ž˜ ๋งž๋Š” ๊ธฐ์—…๋“ค์„ ๋งค์นญ ๋ฐ›์œผ์„ธ์š”.

programmers.co.kr

 

๋ฌธ์ œ

ITEM_INFO ํ…Œ์ด๋ธ”์—์„œ ํฌ๊ท€๋„๊ฐ€ 'LEGEND'์ธ ์•„์ดํ…œ๋“ค์˜ ๊ฐ€๊ฒฉ์˜ ์ดํ•ฉ์„ ๊ตฌํ•˜๋Š” SQL๋ฌธ์„ ์ž‘์„ฑํ•ด ์ฃผ์„ธ์š”. ์ด๋•Œ ์ปฌ๋Ÿผ๋ช…์€ 'TOTAL_PRICE'๋กœ ์ง€์ •ํ•ด ์ฃผ์„ธ์š”.

 

ํ’€์ด

select sum(PRICE) as TOTAL_PRICE
from ITEM_INFO
where RARITY = 'LEGEND'
๋ฐ˜์‘ํ˜•