一.INNER JOIN:关于查询条件关键字 ON 和 WHERE
1.情况:关于ON关键字的查询结果
SELECT employee.id,employee.`name`,department.`name` AS emp,employee.dep_id FROM employee INNER JOIN department on employee.dep_id =department.id
查询结果:
那么关键换成WHERE时 结果还是一样的:
2.情况:关于WHERE关键字的查询结果
LEFT JOIN:左连接
1.情况:关于ON关键字的查询结果
SELECT employee.id,employee.`name`,department.`name` AS emp,employee.dep_id FROM employee LEFT JOIN department ON
employee.dep_id =department.id
结果如下:
2.情况:关于WHERE关键字的查询结果