1左外连接
左表的记录都会出现在结果集中,并上右表与之对应的部分,如果右表没有,使用null填充。
举例。
select * from people p left join role r p.id=r.id
左外连接结果:
2、右外连接
右表的记录都会出现在结果集中,并上左表与之对应的部分,如果左表没有,使用null填充。
select * from people p right join role r p.id=r.id
右外连接结果:
1左外连接
左表的记录都会出现在结果集中,并上右表与之对应的部分,如果右表没有,使用null填充。
举例。
select * from people p left join role r p.id=r.id
左外连接结果:
2、右外连接
右表的记录都会出现在结果集中,并上左表与之对应的部分,如果左表没有,使用null填充。
select * from people p right join role r p.id=r.id
右外连接结果: