입양 시각 구하기(1)

Updated:

이번에는 시간을 기준으로 구해보는 것이다.

문제를 보면 1시간 단위로 간격이 나뉘어지는 것을 알수 있다. 그래서 hour메소드를 써줘야한다

그안에는 DATETIME관련 Column을 넣어주면 되는것 같다

by SQL

-- 코드를 입력하세요
SELECT hour(datetime) as HOUR, count(*) as COUNT
from animal_outs
where hour(datetime) >= 9 and hour(datetime)<=19
group by hour(datetime)
order by hour(datetime)

Leave a comment