Oracle数据库学习第二天对应练习题

Oracle数据库学习第二天对应练习题

1、查询和Zlotkey相同部门的员工姓名和雇用日期

Select ename,hire_date

from emp

where deptno=(

select deptno

from emp

where ename=’Zlotkey’);

2、查询工资比公司平均工资高的员工的员工号,姓名和工资。

Select emp_id,ename,sal

From emp

Where sal>(

Select avg(sal)

From emp

);

3、查询各部门中工资比本部门平均工资高的员工的员工号, 姓名和工资

Select emp_id,ename,salary

From emp e

Where sal>(

Select avg(sal)

From emp

Where deptno=e.deptno

);

4、查询和姓名中包含字母u的员工在相同部门的员工的员工号和姓名

Select emp_id,ename

From emp

Where deptno in(

Select deptno

From emp

Where ename like ‘%u%’

);

5、 查询在部门的location_id为1700的部门工作的员工的员工号

Select emp_id

From emp

Where deptno in(

Select deptno

From departments

Where location_id=1700

);

 6、查询管理者是King的员工姓名和工资

Select ename,salary

From emp

Where manager_id in(

Select emp_id

From emp

Where ename=’King’

);

猜你喜欢

转载自blog.csdn.net/weixin_42617472/article/details/85098359