SELECT d.dname 部门名称,a.seal 部门工资平均值,(b.sseal/a.aseal)*100 比例
FROM dept d,
(select e.deptno,avg(e.sal) seal,sum(e.seal) aseal
from emp e group by e.detno) a,
(select ee.deptno,e.seal sseal from emp ee where ee.ename = 'SMITH') b
WHERE d.deptno = a.deptno and
a.deptno = b.deptno
FROM dept d,
(select e.deptno,avg(e.sal) seal,sum(e.seal) aseal
from emp e group by e.detno) a,
(select ee.deptno,e.seal sseal from emp ee where ee.ename = 'SMITH') b
WHERE d.deptno = a.deptno and
a.deptno = b.deptno
解决方案 »
- 简单问题大家来抢分
- oracle 9i job 问题紧急求救
- oracle reports如何調整各行的間距
- sequence的用法.
- ORACLE批量插入数据
- oracle9i升级补丁到9.2.0.8,在运行catpatch.sql 时报错:SP2-0310:unable to open file "/oracle/product/9.2/rdbms/admin/owapatch.sql"。是不是会影响数据库?
- 如何把数据文件移动一个目录?
- 帮忙分析一下数据库比较慢的原因
- 在SQL中,select * from sysobjects where xtype='u',在ORACLE中是怎么样表达的
- 在ORCALE如何定义一个新的类型??
- 取id号最小的那条记录,该怎么写?谢谢!
- 以下的要求怎么实现呢
而是sql语句语法你会不会的问题~
建议好好学学sql
from emp e,dept d
where d.deptno = e.deptno and e.deptno=(select deptno from emp where ename='SMITH')
group by e.deptno,d.dname