数据库连表查询

1、左连

select a.*,b.* from a left join b on a.id=b.id

把右边的表拼接到左边,如果左边存在,但右边不存在时,右边表会展示为null

2、右边

select a.*,b.* from a right join b on a.id=b.id

与左连相反

3、内连

select a.*,b.* from a inner join b on a.id=b.id

左右都存在时

posted @ 2020-04-15 20:26  taomin  阅读(924)  评论(0编辑  收藏  举报