数据库的分页

一,MySQL

   基本句式

    select * from tableName where  ...  order by ... limit [n,]m;

    就是查询从第n条数据后的m 条数据。n可由可无。

   子查询的分页方式,提高查询速度

    select * from tableName where id>=

    (select id from tableName where ...orderby... limit n,1) limit m;


二, oracle 

   基本句式

    select * from tablename from(select ROWNUM r,t1.* from tablename t1 where

    ROWNUM<=n+m) t2 where t2.r>n;

    select * from (select a.*,ROWNUM r from(select * from tablename)a where ROWNUM<=n+m)

    where a.r>n

原文地址:https://www.cnblogs.com/m01qiuping/p/6410354.html