1.行号是个伪列,rownum 永远按照默认的顺序生成
2.rownum 只能使用< <= 不能使用> >=(原因是oracle数据库是行式数据库,像盖楼一样,没有第一层就排不到第二层)
分页
SELECT r, e2.*
FROM (SELECT rownum AS r, e1.*
FROM (SELECT *
FROM emp
ORDER BY sale
) e1
WHERE rownum <= 8
) e2
WHERE r >= 5;
2023-01-31 14:55:09
SELECT r, e2.*
FROM (SELECT rownum AS r, e1.*
FROM (SELECT *
FROM emp
ORDER BY sale
) e1
WHERE rownum <= 8
) e2
WHERE r >= 5;