๋ฐ์ํ
๋ฌธ์
๊ฐ ๋ถ๊ธฐ(QUARTER)๋ณ ๋ถํ๋ ๋์ฅ๊ท ์ ๊ฐ์ฒด์ ์ด ์(ECOLI_COUNT)๋ฅผ ์ถ๋ ฅํ๋ SQL ๋ฌธ์ ์์ฑํด์ฃผ์ธ์. ์ด๋ ๊ฐ ๋ถ๊ธฐ์๋ 'Q' ๋ฅผ ๋ถ์ด๊ณ ๋ถ๊ธฐ์ ๋ํด ์ค๋ฆ์ฐจ์์ผ๋ก ์ ๋ ฌํด์ฃผ์ธ์. ๋์ฅ๊ท ๊ฐ์ฒด๊ฐ ๋ถํ๋์ง ์์ ๋ถ๊ธฐ๋ ์์ต๋๋ค.
ํ์ด
select
case
when month(DIFFERENTIATION_DATE) between 1 and 3 then '1Q'
when month(DIFFERENTIATION_DATE) between 4 and 6 then '2Q'
when month(DIFFERENTIATION_DATE) between 7 and 9 then '3Q'
when month(DIFFERENTIATION_DATE) between 10 and 12 then '4Q'
end as QUARTER,
count(ID) as ECOLI_COUNT
from ECOLI_DATA
group by QUARTER
order by QUARTER asc
๋ฐ์ํ