常用数据库分页写法 myslq postgresql sql server Oracle

来源:互联网 发布:淘宝男模特去哪里找 编辑:程序博客网 时间:2024/05/16 07:40
mysql 分页
select * from t_order limit 5,10


postgresql 分页


select * from newscontent limit 20 offset 0


sql server 分页


select * from (select top 10 * from (select top (10*6) * from tr_data_userinfo order by available asc) as temptable1 order by available desc) as temptable2 order by available asc


Oracle 分页(rownum)


minus差分页 select * from table where rownum<=10 minus select * from table where rownum<=5


rownum伪列select * from (select rownum tid,t.* from table t where rownum<=10) where tid<=10 and tid>=5


notin相反select * from table where id not in(select id from table where rownum<=5) and rownum<=5


前题是id排序的select * from table where id>(select max(id) from table where rownum<=5) and rownum<=5
0 0
原创粉丝点击