当前位置:   article > 正文

Oracle查询100万到200万之间的数据_oracle查询第100条到200条数据

oracle查询第100条到200条数据

取100-150条数据的方法

1. 最佳选择:利用分析函数

        row_number() over ( partition by col1 order by col2 )                               

比如想取出100-150条记录,按照tname排序    

select tname,tabtype from (                               

            select tname,tabtype,row_number() over ( order by tname ) rn from tab                

         ) where rn between 100 and 150;   从第100条(包含第100条)到第150条数据,总共51条数据

2. 使用rownum 虚列

        select tname,tabtype from (                    

            select tname,tabtype,rownum rn from tab where rownum <= 150                  

         ) where rn >= 100;

查询100万到200万之间的数据:

  1. select ID,
  2. CASEID,
  3. PERSONID,
  4. NAME,
  5. TYPE,
  6. STATE,
  7. ADDRESS,
  8. PHONENO,
  9. CONTACT,
  10. DRIVERLICENSEDOCID,
  11. DRIVERLICENSEISSUEOFFICE,
  12. SEX,
  13. AGE,
  14. WOUNDINFOID,
  15. DRIVINGAGE,
  16. DRIVERLICENSETYPEID,
  17. CONVEYANCEMEANSID,
  18. OUTINGPURPOSE,
  19. ISDRIVER,
  20. ISWEARINGSEATBELT,
  21. UPDATETIME,
  22. UPDATEACCOUNTID,
  23. PARTYUNIT,
  24. PERSONAREACODE,
  25. INJUREDPARTID,
  26. PERSONALTYPEID,
  27. ACCIDENTREASONID,
  28. BUSSINESSCERTIFICATION,
  29. CORPORATION,
  30. ESCAPETIME,
  31. BIRTHDAY,
  32. CORPERATIONSEX,
  33. CORPERATIONAGE,
  34. CORPERATIONADDRESS,
  35. CORPERATIONCONTACT,
  36. CORPERATIONIDNUMBER,
  37. LICENCE,
  38. MEMO,
  39. BCISSUER
  40. from (select ID,
  41. CASEID,
  42. PERSONID,
  43. NAME,
  44. TYPE,
  45. STATE,
  46. ADDRESS,
  47. PHONENO,
  48. CONTACT,
  49. DRIVERLICENSEDOCID,
  50. DRIVERLICENSEISSUEOFFICE,
  51. SEX,
  52. AGE,
  53. WOUNDINFOID,
  54. DRIVINGAGE,
  55. DRIVERLICENSETYPEID,
  56. CONVEYANCEMEANSID,
  57. OUTINGPURPOSE,
  58. ISDRIVER,
  59. ISWEARINGSEATBELT,
  60. UPDATETIME,
  61. UPDATEACCOUNTID,
  62. PARTYUNIT,
  63. PERSONAREACODE,
  64. INJUREDPARTID,
  65. PERSONALTYPEID,
  66. ACCIDENTREASONID,
  67. BUSSINESSCERTIFICATION,
  68. CORPORATION,
  69. ESCAPETIME,
  70. BIRTHDAY,
  71. CORPERATIONSEX,
  72. CORPERATIONAGE,
  73. CORPERATIONADDRESS,
  74. CORPERATIONCONTACT,
  75. CORPERATIONIDNUMBER,
  76. LICENCE,
  77. MEMO,
  78. BCISSUER,
  79. row_number() over(order by id) rn
  80. from TC_PARTY
  81. order by id)
  82. where rn between 1000001 and 2000000

从1000001到2000000,总共100万条数据

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/2023面试高手/article/detail/217220
推荐阅读
相关标签
  

闽ICP备14008679号