select * from (select rownum as rn,a.* from a) where rn=9
关系数据库的原理就是数据行与行之间的是无序的,这里说的第9行可能是:1)按id排序的第9行2)根据rownum = 9来判断select * from ( select t.*, rownum rn from t ) where rn = 9; >且在第九行那里插入一个记录 这个要求本身就是不合理,既然数据在物理存储上是无序,又何以在第9行插入一个记录呢?(除非是IOT表)
换种写法: select a.* from ( select rownum,a.* from infor_dept a where rownum<=9 order by rownum desc) a where rownum <=1
select * from
(select rownum as rn,a.* from a)
where rn=9
from (
select t.*, rownum rn
from t
)
where rn = 9;
>且在第九行那里插入一个记录
这个要求本身就是不合理,既然数据在物理存储上是无序,又何以在第9行插入一个记录呢?(除非是IOT表)
select a.* from (
select rownum,a.* from infor_dept a where rownum<=9 order by rownum desc) a
where rownum <=1