我在上一节SQL编程的课,用的是ORACLE 11G的系统,题目是列出所有高出平均工资的员工?要求是用一个SELECT语句,如果是可以用两个SELECT,我就会编了大致如下:select last_name, salary
from employees
where salary >
(select avg(salary)
from employees);请问如果只允许用一个SELECT语句,如果调出平均工资呢?
from employees
where salary >
(select avg(salary)
from employees);请问如果只允许用一个SELECT语句,如果调出平均工资呢?
select a.last_name, a.salary
from employees a,(select avg(salary) avg_sal
from employees) b
where a.salary > b.avg_sal;
列出比DAVIES早进公司的人。
SELECT e.last_name, e.hire_date
FROM employees e
JOIN employees d
ON e.hire_date > d.hire_date
AND d.last_name = 'Davies';用到了JOIN,但是我按照这样改为select e.last_name, e.salary
from employees e
join employees d
on e.salary>avg(d.salary);结果出错。不知怎么写。