练习答案
玛丽莲梦兔
605次浏览
2020年07月29日 12:02
最佳经验
本文由作者推荐
打量近义词-特质
select ,,,
from dept d,(select deptno,count(*) cou from emp group by deptno) temp
where =
2、 列出薪金比“SMITH”多的所有员工。
select * from emp where sal>(select sal from emp where ename='SMITH')
3、 列出所有员工的姓名及其直接上级的姓名。
select ,
from emp e,emp em
where =
4、 列出受雇日期早于其直接上级的所有员工的编号,姓名,部门名称。
select ,,
from emp e,dept d,emp em
where = and
= and
te<te
5、 列出部门名称和这些部门的员工信息,同时列出那些没有员工的部门。
select ,e.*
from emp e,dept d
where (+)=
6、 列出所有“CLERK”(办事员)的姓名及其部门名称,部门的人数。
select ,,,
from emp e,dept d,(select deptno,count(*) cou from emp group by deptno) temp
where = and
='CLERK' and
=
7、 列出最低薪金大于 1500 的各种工作及此从事此工作的全部雇员人数。
select job,count(*)
from emp
group by job
having min(sal)>1500
8、 列出在部门“SALES”(销售部)工作的员工的姓名,假定不知道销售部的部门编号
select ,d.*
from emp e,dept d
where =
and ='SALES'
9、 列出薪金高于公司平均薪金的所有员工,所在部门,上级领导,公司的工资等级。
select ,,,
from emp e,dept d,emp em,salgrade sg
where = and
=(+) and
between and
and >(select avg(sal) from emp)
10、列出与“SCOTT”从事相同工作的所有员工及部门名称。
select e.*,
from emp e,dept d
where =
and =(select job from emp where ename='SCOTT')
and <>'SCOTT'
11、列出薪金等于部门 30 中员工的薪金的所有员工的姓名和薪金。
select ename,sal
from emp
where sal in (select sal from emp where deptno=30)
12、列出薪金高于在部门 30 工作的所有员工的薪金的员工姓名和薪金、部门名称。
select ,,
from emp e,dept d
where =
and >ALL(select sal from emp where deptno=30)
13、列出在每个部门工作的员工数量、平均工资和平均服务年限。
select deptno,count(*), avg(sal), avg(months_between(sysdate,hiredate)/12) from emp group by deptno
15、列出所有部门的详细信息和部门人数。
16、列出各种工作的最低工资及从事此工作的雇员姓名。
17、列出各个部门的 MANAGER(经理
)的最低薪金。
18、列出所有员工的年工资,按年薪从低到高排序。
19
、查出某个员工的上级主管,并要求出这些主管中的薪水超过 3000
20、求出部门名称中,带‘S’字符的部门员工的、工资合计、部门人数