Blogger Information
Blog 56
fans 7
comment 11
visits 222931
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
MySQL中left join、right join与inner join的区别
樂成的开发笔记
Original
2206 people have browsed it

1、数据库

1.1、作者表

 1432653-20181015000705190-1078960011.png

1.2、图书表

1432653-20181015002325809-1333600946.png

1.3、出版社表

1432653-20181015001010726-1798978833.png

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、查询结果

1432653-20181015002952623-1434372030.png


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、查询结果

1432653-20181015002756664-1562205977.png


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、查询结果

1432653-20181015002859088-399353.png



参考资料

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post