now is better than never
[Level 4][GROUP BY] 입양시각 구하기 (2) ([Oracle] 0에서 23 까지 숫자 생성) 본문
https://school.programmers.co.kr/learn/courses/30/lessons/59413
MySQL로도 풀어보고 싶었으나 실패
<Oracle>
select h.hour, nvl(ao.count,0) count
from
(select level-1 as hour
from dual
connect by level <=24) h
left join
(select to_number(to_char(datetime, 'HH24')) hour, count(*) count
from animal_outs
group by to_number(to_char(datetime, 'HH24')) ) ao
on h.hour = ao.hour
order by h.hour;
'프로그래머스 > SQL' 카테고리의 다른 글
[LEVEL 2][String, Date] 자동차 평균 대여 기간 구하기 (0) | 2023.05.15 |
---|---|
[Level 4][SELECT] 서울에 위치한 식당 목록 출력하기 (0) | 2023.01.04 |
[Level 2][SELECT] 3월에 태어난 여성 회원 목록 출력하기 (SQL 날짜 월 출력) (0) | 2023.01.03 |
[Level 4][JOIN] 보호소에서 중성화한 동물 (0) | 2023.01.03 |
[Level 4][GROUP BY] 저자 별 카테고리 별 매출액 집계하기 (0) | 2023.01.03 |