使用rownum查询某行结果集简述

6.使用伪列 (rownum) 分别查询empnew 前五行记录,  五行之后的数据,第5行—第10行记录

注意事项

l  rownum=1的时候才有用,不能rownum=n(n>1)

l  rownum可以rownum<n(n>1),但是不能单独Rownum>n(n>=1);

l  rownum对于大于某值的查询条件和某行区间查询:需要结合高级子查询,rownum必须使用别名  

前五行:select * from empnew where  rownum<=5;

五行后:select * from (select e.*,rownum伪列 from empnew e) where伪列>=5;

5-10行:select * from (select e.*,rownum伪列from empnew  e) where伪列between5and10;

猜你喜欢

转载自blog.csdn.net/wuzhixing931022/article/details/80267890