当前位置:Gxlcms > 数据库问题 > sql -实验二

sql -实验二

时间:2021-07-01 10:21:17 帮助过:2人阅读

1. 显示部门号为10 的部门名、员工名和工资。

    select emp.ename,emp.sal,dept.dname
    from emp,dept
    where emp.DEPTNO=dept.DEPTNO and dept.DEPTNO=‘10‘;

2. 显示员工BLAKE 的上级领导的姓名。

    select ENAME
     from emp
    where EMPNO=(
        SELECT MGR
        FROM EMP
        WHERE ENAME=‘BLAKE‘
   );

4. 显示工资比部门 30 的所有员工的工资高的员工的姓名、工资和部门号。

select ename,sal,deptno
from  emp
where sal>(
 select sal
 from emp
 where deptno=‘30‘
);

5. 查询与smith 部门和岗位完全相同的所有雇员。

select ename
from emp
where deptno =(select deptno
  from emp
  where ename=‘SMITH‘
) and job=(
  select job
  from emp
  where ename=‘SMITH‘);

6. 显示高于部门平均工资的员工的信息。

select *
from emp
where sal>=(
   select avg(sal)
   from emp
);

7. 查询部门工资总和高于员工工资总和1/3的部门名及工资总和。

 

sql -实验二

标签:

人气教程排行