-
[level 3] 오랜 기간 보호한 동물(1)SQL/SQL 연습문제 풀이 2022. 1. 19. 12:36반응형
https://programmers.co.kr/learn/courses/30/lessons/59044
MySQL
-- MySQL SELECT A.NAME, A.DATETIME FROM ANIMAL_INS A LEFT JOIN ANIMAL_OUTS B ON A.ANIMAL_ID = B.ANIMAL_ID WHERE B.ANIMAL_ID IS NULL ORDER BY A.DATETIME LIMIT 3
Oracle
SELECT * FROM ( SELECT A.NAME, A.DATETIME FROM ANIMAL_INS A LEFT JOIN ANIMAL_OUTS B ON A.ANIMAL_ID = B.ANIMAL_ID WHERE B.ANIMAL_ID IS NULL ORDER BY A.DATETIME) A WHERE ROWNUM<=3
반응형