#内联
SELECT * FROM 
emp e INNER JOIN dept d
ON e.`deptno` = d.`deptno`;

SELECT * FROM 
emp INNER JOIN dept
ON emp.`deptno` = dept.`deptno`;

SELECT * FROM 
emp e , dept d
WHERE e.`deptno` = d.`deptno`;
#14 * 4 = 56 - 14 = 42
SELECT * FROM 
emp e , dept d
WHERE e.`deptno` != d.`deptno`;

#左外联
SELECT * FROM 
dept d LEFT JOIN emp e
ON d.`deptno` = e.`deptno`;

#右外联
SELECT * FROM 
emp e RIGHT JOIN dept d
ON d.`deptno` = e.`deptno`;
#类似全外联
SELECT e.*,d.* FROM 
dept d LEFT JOIN emp e
ON d.`deptno` = e.`deptno`
union
SELECT e.*,d.* FROM 
emp e RIGHT JOIN dept d
ON d.`deptno` = e.`deptno`;
#自然连接14*4
SELECT * FROM 
emp e , dept d;
#自连接
select 
	e1.`ename` 员工,
	e2.`ename` 上级
from 
emp e1 left join emp e2
on e1.`mgr` = e2.`empno`;

SELECT 
	e1.`ename` 员工,
	e2.`ename` 上级
FROM 
emp e1 inner JOIN emp e2
ON e1.`mgr` = e2.`empno`;


