Oracle_rowid_rownum_分页
--rowid select * from account where rowid=‘AAASR6AAEAAAAJWAAA‘; |
select * from stu; select rownum, stu.* from stu; select rownum, e.* from emp e; --Top5,查询工资最高的5个人信息 select rownum, t.* from ( select * from emp order by sal desc ) t where rownum<=5; |
--row实现分页 select rownum, t.* from ( select * from emp order by sal desc ) t where rownum>5 and rownum<=10;--不行,rownum只能<,<= --下面的方式实现子查询 select rownum, t.* from ( select * from emp order by sal desc ) t where rownum<=10; |
--分页查询,查询6到10行记录 select * from ( select rownum rn, t.* from ( select * from emp order by sal desc ) t where rownum<=10 ) temp where temp.rn>5 and temp.rn<=10; |
时间: 2024-10-06 20:45:50