--1、
select t1.deptno, t1.dname, t2.empno, t2.ename, t2.mgr
from dept t1
left join emp t2
on t1.deptno = t2.deptno
order by t1.deptno, t2.empno;
--2、
select t2.empno employer_no,
t2.ename employer_name,
t1.empno employee_no,
t1.ename employee_name
from emp t1
left join emp t2
on t2.empno in t1.mgr;
时间: 2024-11-10 15:04:30