分页的区别,MySQL 和Oracle,sqlServer

mysql 常用的分页方式:(1)limit分页公式:curPage是当前第几页;pageSize是一页多少条记录

select  *  from   dual  where  1=1  limit (curPage-1)*pageSize,pageSize 

 

Oracle  常用的分页方式:

select *
from(select d.*,row_number() over(order by d.BIRTHDAY) as rownumber
from DONORINFO d
WHERE d.BIRTHDAY BETWEEN TO_DATE ('19800101', 'yyyymmdd')
AND TO_DATE ('20060731', 'yyyymmdd')
) p
where p.rownumber BETWEEN size*(page-1)+1 AND page*size;

sqlserver 常用的分页方式:

select top pageSize, o.* from ( select row_number() over(order by orderColumn) as rownumber,* from(sql) as o where rownumber>firstIndex;

 

posted @ 2021-03-01 15:08  夏之  阅读(153)  评论(0编辑  收藏  举报