๐Ÿ’ SQL (Programmers)/String, Date

[ํ”„๋กœ๊ทธ๋ž˜๋จธ์Šค][SQL] ํ•œ ํ•ด์— ์žก์€ ๋ฌผ๊ณ ๊ธฐ ์ˆ˜ ๊ตฌํ•˜๊ธฐ

์„ ๋‹ฌ 2024. 10. 16. 18:09
๋ฐ˜์‘ํ˜•

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

 

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

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

programmers.co.kr

 

๋ฌธ์ œ

FISH_INFO ํ…Œ์ด๋ธ”์—์„œ 2021๋…„๋„์— ์žก์€ ๋ฌผ๊ณ ๊ธฐ ์ˆ˜๋ฅผ ์ถœ๋ ฅํ•˜๋Š” SQL ๋ฌธ์„ ์ž‘์„ฑํ•ด์ฃผ์„ธ์š”.
์ด ๋•Œ ์ปฌ๋Ÿผ๋ช…์€ 'FISH_COUNT' ๋กœ ์ง€์ •ํ•ด์ฃผ์„ธ์š”.

 

ํ’€์ด

select count(ID) as FISH_COUNT
from FISH_INFO
where year(TIME)='2021'
group by year(TIME)
๋ฐ˜์‘ํ˜•