测试必备的Mysql常用sql语句系列
https://www.cnblogs.com/poloyy/category/1683347.html
SELECT <字段名> FROM <表1> LEFT OUTER JOIN <表2> <ON子句>
SELECT <字段名> FROM <表1> RIGHT OUTER JOIN <表2> <ON子句>
leftjoin
select * from emp as a left join dept as b on a.dept_id = b.id;
select * from emp as a left join dept as b on a.dept_id = b.id where b.id is null;
where
select * from emp as a right join dept as b on a.dept_id = b.id;