oracle 查询没有经理的员工姓名,所属部门名称和部门地点,分部门显示;

3张表是这样的,求大神帮忙 谢谢
2025-01-31 17:13:26
推荐回答(1个)
回答1:

SELECT E.EMPLOYEE_ID, FIRST_NAME, LAST_NAME, D.DEPARTMENT_NAME, L.STREET_ADDRESS
FROM EMPLOYEES E
LEFT JOIN DEPARTMENTS D ON E.DEPARTMENT_ID = D.DEPARTMENT_ID
LEFT JOIN LOCATIONS L ON D.DEPARTMENT_ID = L.DEPARTMENT_ID
WHERE 1=1
AND E.MANAGER_ID IS NULL
没测试,主要是这个了,其他的细节自己加吧。