[PGS] 오랜 기간 보호한 동물(2)

Organ·2023년 10월 24일
0

[문제 풀이]

목록 보기
97/123
post-thumbnail

문제


예제

내 풀이

-- 코드를 입력하세요
-- SELECT I.ANIMAL_ID, I.NAME 
-- FROM ANIMAL_INS I JOIN ANIMAL_OUTS O ON I.ANIMAL_ID = O.ANIMAL_ID
-- WHERE ROWNUM <= 2
-- ORDER BY O.DATETIME - I.DATETIME DESC;

SELECT *
FROM
(
    SELECT I.ANIMAL_ID, I.NAME 
    FROM ANIMAL_INS I JOIN ANIMAL_OUTS O ON I.ANIMAL_ID = O.ANIMAL_ID
    ORDER BY O.DATETIME - I.DATETIME DESC
)
WHERE ROWNUM <= 2;

정리

FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY
FROM - WHERE - GROUP BY - HAVING - SELECT - ORDER BY

0개의 댓글