当前位置:Gxlcms > 数据库问题 > 数据库的分页

数据库的分页

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

一,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

数据库的分页

标签:mit   from   tab   基本   分页   数据   order   where   ora   

人气教程排行