码迷,mamicode.com
首页 > 数据库 > 详细

Oracle百万数据查询语句

时间:2017-09-05 16:58:38      阅读:175      评论:0      收藏:0      [点我收藏+]

标签:数据   from   logs   creat   over   city   oracle   nbsp   name   

SELECT *
  FROM (SELECT e.*, ROWNUM rn
          FROM (SELECT id,
                       name,
                       age,
                       birthDate,
                       sex,
                       describe,
                       city,
                       create_by,
                       create_date,
                       update_by,
                       update_date,
                       del_flag
                  FROM t_employee
                 where del_flag = 0
                 order by create_date desc) e
         WHERE ROWNUM <= 1000000)
 WHERE rn > 999980;

 

select id,
       name,
       age,
       birthDate,
       sex,
       describe,
       city,
       create_by,
       create_date,
       update_by,
       update_date,
       del_flag
  from t_employee t1,
       (select rid
          from (select rownum rn, t.rid
                  from (select
                         rowid rid
                          from t_employee
                        where del_flag = 0
                        order by create_date desc) t
                 where rownum <= 1000000)
         where rn > 999980) t2
 where t1.rowid = t2.rid;

 

select *
  from (select *
          from (select id,
                       name,
                       age,
                       birthDate,
                       sex,
                       describe,
                       city,
                       create_by,
                       create_date,
                       update_by,
                       update_date,
                       del_flag,
                       row_number() OVER(ORDER BY create_date desc) AS rn
                  from t_employee) p
         where p.rn > 999980) q
 where rownum < = 20

 

Oracle百万数据查询语句

标签:数据   from   logs   creat   over   city   oracle   nbsp   name   

原文地址:http://www.cnblogs.com/liuzhenping/p/7479079.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!