Coding Test
[SQL 프로그래머스] 입양 시각 구하기(1)
hyungminjeon
2024. 6. 14. 17:19
[문제]

[해결]
SELECT hour(datetime) HOUR,
count(hour(datetime)) COUNT
from animal_outs
where hour(datetime) >= 9 and hour(datetime) <= 19
group by 1
order by 1
[정리 및 새롭게 알게 된 점]
HOUR함수를 이용해 datetime으로 부터 시간값을 추출하고,
where 절에서 9시부터 19시까지의 시간에 대해 datetime의 개수(count)를 구하였다.