不同数据库分页总结

来源:互联网 发布:戴比尔斯钻石骗局 知乎 编辑:程序博客网 时间:2024/05/21 23:59

总结下主流的MYSQL,sqlSever 和oracle的数据库的分页代码,如下:

MySQL:select * from  TableName where …… limit start_th , count_num;  SqlSever:select top count_num  from TableName where id not in (select top count_num from TableName  where ……);
Oracle:select t2.* from (select t1.* ,rownum rn from (select * from TabbleName where ……) t1 where rownum <=endline ) t2 where t2.rn>=start_line;
oracle 的条件筛选都放在最内层进行第一层筛选,剔除末尾的(第二层),剔除头部的(第三层)大笑
供大家参考!

0 0
原创粉丝点击