我正在使用Oracle数据库,我有一个包含19亿行记录的表。我想获得100,000,001到200,000,000之间的记录行。有人可以帮我吗?提前谢谢。
答案 0 :(得分:2)
一般来说,您需要一个分页查询,其格式为:
select t.*
from (select t.*, rownum rn
from (select t.yourfields
from yourtab t
order by t.something)
where rownum <= end_rownum
) t
where rn >= offset;
或
select *
from (select t.yourfields, row_number() over (order by t.something) rn
from yourtab t)
where rn between start_rownum and end_rownum;
答案 1 :(得分:0)
如果你的意思是那些范围是rownum
,那么这里的查询很简单
select * from (select e.*,rownum test from hr.employees e) where test>5 and test <50;