当前位置:Gxlcms > 数据库问题 > 各种数据库的分页查询

各种数据库的分页查询

时间:2021-07-01 10:21:17 帮助过:30人阅读

1、oracle

通过子查询rownum方式处理

内层查询控制最大值,外层查询控制最小值

示例:

select * from ( select a.*,rownum rn from table where rn < endrow) a where a.rn > startrow

 

 2、mysql

通过limit直接处理

select * from table limit startrow ,endrow

 

3、通用模式

使用差集的方式,先查询出最大的行数 ,再查出最小的行数,二者取差集

示例:

select * from table where rownum < endrow and

id not in ( select id from table where rownum < startrow) 

各种数据库的分页查询

标签:ble   数据   使用   mysq   mit   最大的   tab   start   not   

人气教程排行