内连接inner join
(第1种写法)select a.name,b.name from t_table1 a join t_table2 b on a.id=b.id
(第2种写法)select a.name b.name from t_table1 a inner join t_table2 b on a.id=b.id
两表之间的左连接(右连接完全是简单的举一反三,所以就不写了)
select a.name,b.name from t_table1 a left join t_table b on a.id=b.id
4表之间的左连接(t_table1 既需要左关联t_table2,又同时需要左关联t_table3,t_table4无用)
select a.name,b.name,c.name
from t_table1 a left join t_table2 b on a.id=b.id left join t_table3 c on a.id=c.id,
t_table4 d
where a.id=d.id
等连接
select a.name,b.name from t_table1 a,t_table b
where a.id=b.id
全连接(full join)
select a.name,b.name from t_table1 a full join t_table2 b on a.id=b.id