假设有两个表结构如下:

表table1

inner join, left join ,right join 结果-LMLPHP

表 table 2

inner join, left join ,right join 结果-LMLPHP

内连接:

--内连接
select *
from table1 inner join table2 on table1.ID = table2.ID

结果:

inner join, left join ,right join 结果-LMLPHP

左外连接:

--左连接
select *
from table1 left join table2 on table1.ID = table2.ID

结果:

inner join, left join ,right join 结果-LMLPHP

右外连接:

--右连接
select *
from table1 right join table2 on table1.ID = table2.ID

结果:

inner join, left join ,right join 结果-LMLPHP

全连接:

select *
from table1 full join table2 on table1.ID = table2.ID

结果:

inner join, left join ,right join 结果-LMLPHP

05-28 17:45