bulrush

book表:

t_book表:

一:inner join  AB共有的。

 

1 select * from book
2 inner join t_book
3     on book.t_id=t_book.t_id

查询结果:

二:left join  A表的所有,B表没有的用null

 

select * from book
left join t_book
    on book.t_id=t_book.t_id

 输出结果:

三:RIGHT JOIN  B表的所有,A表没有的用Null

 

1 select * from book
2 right join t_book
3     on book.t_id=t_book.t_id

输出结果:

四:left join where b.id is not null

 

select * from book
left join t_book
    on book.t_id=t_book.t_id
where t_book.t_id is not null ;

 

 五:right join where a.id is not null

select * from book
right join t_book
    on book.t_id=t_book.t_id
where book.t_id is not null ;

 

 

六:full outer join 

七:full outer join where b.id is not null

 

 第六和第七MySQL没有这种写法

八:笛卡尔集   两个表相乘。

select * from book,t_book

 

分类:

技术点:

相关文章:

  • 2021-07-02
  • 2021-06-10
猜你喜欢
  • 2023-03-23
  • 2021-11-20
  • 2021-07-25
  • 2021-11-20
  • 2021-08-23
  • 2022-12-23
相关资源
相似解决方案