SELECT * from employees where salary>(
SELECT salary
from employees
where employee_id=149
);
select last_name,job_id,salary from employees
WHERE job_id=(
select job_id from employees where
employee_id=141
)
and salary>(
SELECT salary
from employees
where employee_id=143
) ;
SELECT last_name,job_id,salary
from employees
where salary=(
select min(salary)
FROM employees
);
#法1
select employee_id,manager_id,department_id
from employees
where manager_id=(
SELECT manager_id
FROM employees
where employee_id=141
)
and department_id=(
SELECT department_id
FROM employees
where employee_id=141
)and employee_id !=141;
#法2
select employee_id,manager_id,department_id
from employees
where (manager_id,department_id)=(
SELECT manager_id,department_id
FROM employees
where employee_id=141
) and employee_id !=141;
#聚合函数参与运算删选条件用having
SELECT department_id,min(salary)
FROM employees
where department_id is not null
GROUP BY
HAVING min(salary)>(
SELECT min(salary)
from employees
WHERE department_id=110
);
select employee_id ,last_name
from employees
where salary=(
select min (salary)
from employees
GROUP BY department_id
);