oracle 中的一道查询题
来源:百度知道 编辑:UC知道 时间:2024/05/24 02:34:01
查询员工表中工资最高的5个人的名字
楼上语句不正确,可以去测试下
应该是
select * from (select * from table order by salary desc) where rownum<6
select * from (select * from table order by salary desc) where rownum<6
是正确的
select name from table
where rownum<=5
order by payment desc
select * from (select * from table order by salary desc) where rownum<6
Oracle 的规则 先取行号再排序 因此应将排序语句放在子查询里面,一楼的写法不对。