문제
MYSQL
내가 작성한 정답
select ID,LENGTH
from FISH_INFO
where LENGTH is not null
order by 2 desc, 1
limit 10;ORACLE → 문제에 oracle은 없음
1. fetch
select ID, LENGTH
from FISH_INFO
where LENGTH is not null
order by LENGTH desc, ID
fetch first 10 rows only;
*** 상위 3번째부터 5개 출력
SELECT *
FROM 테이블명
ORDER BY 정렬컬럼
OFFSET 2 ROWS FETCH NEXT 5 ROWS ONLY;2. rownum 사용
select * from (
select ID, LENGTH
from FISH_INFO
where LENGTH is not null
order by LENGTH desc, ID
)
where rownum <= 10;
Share article