|
步骤 2 : 答案
1. 查询部门编号大于等于50小于等于90的部门中工资小于5000的员工的编号、部门编号和工资
2. 显示正好为5个字符的员工的姓名
3. 显示示不带有“ R ”的员工的姓名
4. 显示员工的详细资料,按姓名排序
5. 查询部门所在位置信息中同时包含a和e的所有员工
(提示:多表关联 部门表department关联到location表)
1. 查询部门编号大于等于50小于等于90的部门中工资小于5000的员工的编号、部门编号和工资
select e.employee_id,e.department_id,e.salary from hr.employees e where e.department_id between 50 and 90 and e.salary<5000
2. 显示正好名字为5个字符的员工的姓名
select *from hr.employees e where e.first_name like '_____'
3. 显示示不带有“ R ”的员工的姓名
select *from hr.employees e where e.first_name not like '%R%' and e.first_name not like '%r%'
4. 显示员工的详细资料,按姓名排序
select * from hr.employees e order by e.first_name
5. 查询部门所在位置信息中同时包含a和e的所有员工
(提示:多表关联 部门表department关联到location表)
select e.first_name, d.department_name, l.street_address from hr.employees e
left join hr.departments d
on e.department_id =d.department_id
left join hr.locations l
on d.location_id = l.location_id
where l.street_address like '%a%' or l.street_address like '%e%'
查询部门编号大于等于50小于等于90的部门中工资小于5000的员工的编号、部门编号和工资
显示员工姓名加起来一共15个字符的员工 显示不带有“ R ”的员工的姓名 查询所有员工的部门的平均工资,要求显示部门编号,部门名,部门所在地(需要多表关联查询: employees, department, location)
在查看答案前,尽量先自己完成,碰到问题再来查看答案,收获会更多
HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。
|