比普通员工的最高薪水值还高的部门经理人名称
select ename from emp
where empno in
(select distinct mgr from emp where mgr is not null)
and sal > ( select max(sal) from emp where empno not in
(select distinct mgr from emp where mgr is not null) );
因为 (select distinct mgr from emp where mgr is not null) 重复了,所以我建立一个视图
create view v$mgr_info as select distinct mgr from emp where mgr is not null;我要如何写才能用这个视图来替代重复的地方呢?还有用视图时应该注意的东西?
select ename from emp
where empno in
(select distinct mgr from emp where mgr is not null)
and sal > ( select max(sal) from emp where empno not in
(select distinct mgr from emp where mgr is not null) );
因为 (select distinct mgr from emp where mgr is not null) 重复了,所以我建立一个视图
create view v$mgr_info as select distinct mgr from emp where mgr is not null;我要如何写才能用这个视图来替代重复的地方呢?还有用视图时应该注意的东西?
解决方案 »
- oracle 10G优化问题
- 请问用@指令上传自己建好的表(文件夹内有三个文件)到数据库具体步骤对吗?//谢谢
- 如何选择使用数据库(sql server 和 Oralce ),它们之间的差别是什么,请各位数据库大虾参与讨论,公司要我出个方案,急啊!
- 求一简单的sql语句
- 我遇到了toad的启动问题,toad一闪就没了
- union查询两张表,是同时执行么,还是一前一后啊
- 关于表的存储参数的问题
- 将 Oracle 与 Developer/2000 安装在同一台机器上出现问题
- 如何在ORACLE中实现如下的SQL查询
- 两条相同数据提交时相差101毫秒。都被数据库存了进去。
- oracle如何象sql查询分析器那样去建表 建库 等等
- 关于oralce系统权限的初级问题
where empno in
(select mgr from mgr_info )
and sal > ( select max(sal) from emp where empno not in
(select mgr from mgr_info ) ); 视图是你建立的已有表的一个映射,如果原表的数据发生变化,
视图也会自动发生变化