nature join
它会帮你自动查询两张连接表中所有相同的字段,然后进行等值连接。
SELECT employee_id,last_name,department_name
FROM employees e JOIN departments d
ON e.`department_id` = d.`department_id`
AND e.`manager_id` = d.`manager_id`;
# 等价于
SELECT employee_id,last_name,department_name
FROM employees e natural join departments d;