-
[프로그래머스] 입양 시각 구하기(1) MYSQLCoding Test/programmers 2023. 1. 7. 01:08728x90
문제 설명
보호소에서는 몇 시에 입양이 가장 활발하게 일어나는지 알아보려 합니다. 09:00부터 19:59까지, 각 시간대별로 입양이 몇 건이나 발생했는지 조회하는 SQL문을 작성해주세요. 이때 결과는 시간대 순으로 정렬해야 합니다.
풀이
SELECT HOUR(DATETIME) AS HOUR, COUNT(DATETIME) AS COUNT FROM ANIMAL_OUTS WHERE HOUR(DATETIME) >= 9 AND HOUR(DATETIME) <= 19 GROUP BY HOUR(DATETIME) ORDER BY HOUR(DATETIME);
728x90'Coding Test > programmers' 카테고리의 다른 글
[프로그래머스] 개인정보 수집 유효기간 c++ (0) 2023.01.17 [프로그래머스] 동명 동물 수 찾기 MYSQL (0) 2023.01.07 [프로그래머스] 진료과별 총 예약 횟수 출력하기 MYSQL (0) 2023.01.07 [프로그래머스] 성분으로 구분한 아이스크림 총 주문량 MYSQL (0) 2023.01.07 [프로그래머스] 우박수열 정적분 c++ (0) 2023.01.07