https://school.programmers.co.kr/learn/courses/30/lessons/59413?language=oracle
-- 코드를 입력하세요
SELECT B.HOUR, NVL(A.COUNT, 0) AS COUNT
FROM
(SELECT TO_CHAR(DATETIME, 'HH24') AS HOUR, COUNT(*) AS COUNT
FROM ANIMAL_OUTS
GROUP BY TO_CHAR(DATETIME, 'HH24')
ORDER BY HOUR ASC) A RIGHT OUTER JOIN
(
SELECT LEVEL-1 AS HOUR
FROM DUAL
CONNECT BY LEVEL <= 24
) B
ON A.HOUR = B.HOUR
ORDER BY B.HOUR