Eggs Sunny Side Up
본문 바로가기
Algorithm/Programmers_Oracle_MySQL

[MySQL] 입양 시각 구하기(1)

by guswn100059 2023. 3. 19.

 

-- 코드를 입력하세요
SELECT * FROM ANIMAL_OUTS;

SELECT HOUR(DATETIME) AS HOUR
     , COUNT(DATETIME) AS COUNT
  FROM ANIMAL_OUTS
 WHERE HOUR(DATETIME) BETWEEN 9 AND 19
 GROUP BY HOUR(DATETIME)
 ORDER BY HOUR(DATETIME);

※DATETIME에서 시간만 확인해보고싶을 땐,

HOUR(DATETIME)으로 코드작성!

댓글