【SQL】表连接——SQL JOINS:left join、right join、inner join
1.left join (左连接)(省略outer,全名:left outer join)
返回包括左表中的所有记录和右表中连接字段相等的记录
select * from tableA a left join tableB b on a.key = b.key;
2.right join (右连接)
返回包括右表中的所有记录和左表中连接字段相等的记录
select * from tableA a right join tableB b on a.key = b.key;
3.inner join (内连接)
返回两个表中连接字段相等的记录(即求交集)
select * from tableA a inner join tableB b on a.key = b.key;