#查询编号>3的女神的男朋友信息,如果有则列出详细的,如果没有则用null填充
SELECT
b.*
FROM
boys b
RIGHT OUTER JOIN
beauty z
ON
b.`id`=z.`boyfriend_id`
WHERE
z.`id`>3;
#查询哪个城市没有部门
SELECT
city
FROM
departments d
RIGHT OUTER JOIN
locations l
ON
d.`location_id`=l.`location_id`
WHERE
d.`department_id` IS NULL
#查询部门名字为sal或者IT的员工信息
SELECT
e.*,d.`department_name`
FROM
employees e
RIGHT OUTER JOIN
departments d
ON
e.department_id =d.`department_id`
WHERE
d.`department_name` IN('SAL','IT');