inner join 、left join 、right join 和full join的区别
测试表:
EMP表 SAL表
left join :结果左边表格全部行都显示,右边表格判断列与左边一致才有数据。
select * from EMP Left join SAL on EMP.ENAME = SAL.ENAME;
right join:结果右边表格全部行都显示,左边表格判断列与右边表格一致才有数据
Select * from EMP Right join SAL on EMP.ENAME = SAL.ENAME;
inner join:左右表格判断列一致才有数据;
SELECT * FROM EMP inner join SAL on EMP.ENAME = SAL.ENAME;
full join :左右表格的行全部都有,左右表格判断一致的在同一行,不一致的单独一行。
SELECT * FROM EMP full join SAL on EMP.ENAME = SAL.ENAME;