1. 程式人生 > 其它 >牛客網刷題之SQL-24.獲取所有非manager員工當前的薪水情況

牛客網刷題之SQL-24.獲取所有非manager員工當前的薪水情況

技術標籤:筆記MySQL

獲取所有非manager員工當前的薪水情況

目錄

獲取所有非manager員工當前的薪水情況

1. 題目

2. 解題

3. 思路


1. 題目


2. 解題

select dept_no, e.emp_no, salary
from employees e, salaries s, dept_emp de
where e.emp_no=s.emp_no and e.emp_no=de.emp_no and s.to_date='9999-01-01'
and e.emp_no not in (
    select emp_no from dept_manager
    );

3. 思路

思路來源:https://www.bilibili.com/video/BV175411s7yr?p=24
1)查詢所有員工的情況
2)篩選掉manager的員工