分页SQL

作者: 你家门口的两朵云 | 来源:发表于2020-10-14 10:21 被阅读0次

    分页

    select * from employees e where rownum between 6 and 10;
    

    rownum,rowid

    select * from employees e where rownum between !=1;//查不出结果
    
    select * from employees e where rownum between =1;//查得出结果
    
    select * from employees e where rownum between >1;//查不出结果
    

    分页SQL

    select*from
    (select e.employee_id,e.first_name from employees e  rownum rn from employees e) where rn between 6 and 10;
    //涉及到字段要注意
    
    select e.employee_id ,e.first_name,rowunm rn from employees e where rownum<=10
    minuse
    select e.employee_id ,e.first_name,rowunm rn from employees e where rownum<=5
    
    
    select t2.employee_id,t2.first_name t2.rn
      (select t1.employee_id,t1.first_name  rownum rn from
          (select e.employee_id,e.first_name from employees e order by     
          e.employee) t1 where t1.rn <=10
      ) t2 where t2.rn>=6
    
    

    相关文章

      网友评论

          本文标题:分页SQL

          本文链接:https://www.haomeiwen.com/subject/rdlnpktx.html