问题: 查找薪金水平处于第四位的雇员 表名 employees 列 last_name和salary
select last_name,salary
from (select rownum rm,
(select salary,last_name
from employees
order by salary desc)
from employees) haha
where haha.rm = 4我是这样写的 提示错误 order by 位置 缺失右括号 用ORACLE 数据库
各位大哥帮帮忙~~谢谢
select last_name,salary
from (select rownum rm,
(select salary,last_name
from employees
order by salary desc)
from employees) haha
where haha.rm = 4我是这样写的 提示错误 order by 位置 缺失右括号 用ORACLE 数据库
各位大哥帮帮忙~~谢谢
解决方案 »
- ORACLE 10G(64位) plsql安装问题 求解决方案
- 最近在用oracle sql developer,插入中文乱码~!~!~!~!~!~!
- 急求ETL工具使用视频的下载地址
- 帮忙看看这个追踪日志文件的内容意思
- oracle如何获得一张表所在的数据库名
- 急,在线等待:怎样在存储过程中写动态创建表和触发器的脚本?
- Net8配置成功,连接却出问题!请高手看看
- Oracle远程链接sqlserver
- 技术性问题:用pro*c 批量读取,批量插入,交替进行。详情如下:
- 通信文道结束错误的处理
- 如何查询一个字段是否以数字开头
- ORA-09925: Unable to create audit trail file
select salary,last_name,row_number()over(order by salary desc) rn
from employees
)
where rn=4;
from
(select last_name,salary,row_number()over(order by salary desc) rownum
from employees)
where rownum=4;--or
子查询 不写了
只会rownum这东西~……
select last_name,salary
from
(select salary,last_name,row_number() over(order by salary desc) rn
from employees)
where rn = 4
select last_name,salary
from
(select salary,last_name,rownum rn
from employees order by salary desc)
where rn = 4
select last_name,salary from(
select select salary,last_name,rownum rn from(
select salary,last_name from employees order by salary desc)
)
where rn = 4
select last_name,salary from(
select salary,last_name,rownum rn from(
select salary,last_name from employees order by salary desc)
)
where rn = 4
其结果如下
SALARY LAST_NAME
------- ------------
14000 Russell
from (select last_name,
salary,
rank() over(partition by last_name order by salary desc) rank
from employee) a
where a.rank = 4
from (select rownum rm,a.salary,a.last_name
from
(select salary,last_name
from employees a
order by salary desc)
) h