一、总结:数据库连接分为inner join(内连接)、left join(左连接)、right join(右连接)、full join(全连接)四种
二、用法:
1、两张表连接查询
select table1.column,table2.column from table1 join table2 on table1.column1=table2.column2;
2、当存在多张表连接时,直接多个连接查询连接即可
select table.column,table2.column,table3.column from table1 left join table2 on table1.column1=table2.column2 left join table3 on table2.column3=table3.column4…
三、详细说明
1、inner join内连接 返回两张表同时满足on条件的数据 与join是相同的 与直接两张表关联查询也是一样的;
2、left join左连接 返回左表的全部数据,即使右表存在不满足on条件的数据 ;
3、right join 右连接 返回右表的全部数据,即使左表中存在不满足on条件的数据;
4、full join 全连接 将左表和右表的数据全部返回,即使存在不满足on条件的数据。