服务器之家:专注于服务器技术及软件下载分享
分类导航

Mysql|Sql Server|Oracle|Redis|MongoDB|PostgreSQL|Sqlite|DB2|mariadb|Access|数据库技术|

服务器之家 - 数据库 - Oracle - oracle通过行范围查询取4至10行

oracle通过行范围查询取4至10行

2019-12-13 12:07whsnow Oracle

这篇文章主要介绍了oracle通过行范围查询取4至10行,以EMP表为范例,需要的朋友可以参考下

不能直接用rownum,要查询出来以后用别名转换。

以EMP表为范例,取4至10行:

?
1
select * from (select rownum id,t.* from emp t) where id between 4 and 10;

有需要排序的,一定要这样处理:

?
1
2
3
4
select * from (
select rownum rn,t.* from (
select a.* from eba02 a order by eba003) t where rownum <= 110)
where rn >= 110;

延伸 · 阅读

精彩推荐