首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > oracle >

oracle的emp表,先按工资排序,然后查询出第三到第六行的名字,工资解决办法

2013-09-11 
oracle的emp表,先按工资排序,然后查询出第三到第六行的名字,工资select * from (select rownum as r, enam

oracle的emp表,先按工资排序,然后查询出第三到第六行的名字,工资
select * from (select rownum as r, ename,sal from emp order by sal) where r>=3 and r<=6;
--结果应该是1100,1250,1250,1300
--上边的语句是不是先排序的  结果 1250 1250 2850 2975 
select * from (select ename,sal from emp order by sal) where rownum >=3 and rownum <=6;
--未选定行  
网上也查了,但是没找到解决的办法,真心求指导
[解决办法]
select ename,sal from ( 
select ename,sal,rownum rn from ( 
select ename,sal from emp order by sal
) where rownum<=6
) where rn>=3
我的异常网推荐解决方案:软件开发者薪资,http://www.myexception.cn/other/1391128.html

热点排行