虽然接触过SQL,但是接触的时间并不算太长,现在下午在和大家一起学oracle从SQL开始吧。
一个题目。我竟然能理解错
找到部门平均工资大于Diana所在部门最大工资的部门名字
SELECT department_name
FROM departments
WHERE department_id in(SELECT department_id
FROM employees
GROUP BY department_id
HAVING AVG(salary) > (SELECT MAX(salary)
FROM employees
WHERE department_id =
(SELECT department_id
FROM employees
WHERE first_name like
'Diana')
)
)
一个题目。我竟然能理解错
找到部门平均工资大于Diana所在部门最大工资的部门名字
SELECT department_name
FROM departments
WHERE department_id in(SELECT department_id
FROM employees
GROUP BY department_id
HAVING AVG(salary) > (SELECT MAX(salary)
FROM employees
WHERE department_id =
(SELECT department_id
FROM employees
WHERE first_name like
'Diana')
)
)
评论