多表join的sql

EXPLAIN SELECT employee.name, department.name, project.name
FROM employee
left join department on employee.department_id = department.id
left join project on department.project_id = project.id
WHERE department.type = hrbp AND employee.age >= 30 AND department.employee_count > 30;

join中的department.id, department.type, department.employee_count加索引

posted on 2022-04-07 15:44  Go_Forward  阅读(225)  评论(0编辑  收藏  举报