1、数据库

1.1、作者表

MySQL中left join、right join与inner join的区别

 

1.2、图书表

MySQL中left join、right join与inner join的区别

1.3、出版社表

MySQL中left join、right join与inner join的区别

2、left join

  left join(左联接) 返回包括左表中的所有记录和右表中联结字段相等的记录。

2.1、sql语句

select * from app01_publisher left join app01_book on app01_publisher.id = app01_book.publish_id

 

2.2、查询结果

MySQL中left join、right join与inner join的区别

3、right join

  right join(右联接) 返回包括右表中的所有记录和左表中联结字段相等的记录。

3.1、sql语句

select * from app01_publisher right join app01_book on app01_publisher.id = app01_book.publish_id

 

3.2、查询结果

MySQL中left join、right join与inner join的区别

4、innner join

  inner join(等值连接) 只返回两个表中联结字段相等的行。

4.1、sql语句

select * from app01_publisher inner join app01_book on app01_publisher.id = app01_book.publish_id

 

4.2、查询结果

MySQL中left join、right join与inner join的区别

 

相关文章:

  • 2021-04-24
  • 2021-05-28
  • 2021-09-13
  • 2021-10-26
  • 2022-02-15
猜你喜欢
  • 2021-12-24
  • 2022-02-08
  • 2022-12-23
  • 2021-07-31
  • 2022-12-23
  • 2022-01-04
相关资源
相似解决方案