牛客SQL24
获取所有非manager员工薪水情况,给出dept_no、emp_no以及salary,以上例子输出:
--SQL24
select t4.dept_no as dept_no, t3.emp_no as emp_no, t4.salary as salary
from
(
select t1.emp_no as emp_no
from
employees t1
left join
dept_manager t2
on t1.emp_no=t2.emp_no
where t2.emp_no is NULL
) t3
join
(
select t1.emp_no as emp_no, t1.salary as salary, t2.dept_no
from
salaries t1 join dept_emp t2
on t1.emp_no=t2.emp_no
) t4
on t3.emp_no=t4.emp_no;