_037_MySQL_多表连接案例

use db_mysql;
select a.id,a.name ,b.*
from beauty a left outer join boys b on a.boyfriend_id=b.id
where a.id>3;

 

select a.city,b.*
from departments b right outer join locations a  
on a.location_id=b.location_id
where b.location_id is null;

#一个部门可以0个或多个员工
select a.*,b.department_id,b.department_name
from departments b left outer join employees a
on a.department_id=b.department_id
where b.department_name in ('SAL','IT');

猜你喜欢

转载自blog.csdn.net/poiuyppp/article/details/83097185