-
20200324 连接查询作业
2020-07-24 10:571、查询张姓员工的员工信息和所在部门信息。
SELECT * FROM emp a LEFT JOIN dept b ON a.dept_id = b.id WHERE a.
name
LIKE '张%'2、查询张三丰管理了几个员工
SELECT count(b.id) FROM emp a INNER JOIN emp b ON a.id = b.leader WHERE a.
name
= '张三丰'3、查询出所有实习员工(实习员工无部门信息)
SELECT * FROM emp a LEFT JOIN dept b ON a.dept_id = b.id where b.id IS NULL