MySQL中left join、right join与inner join的区别
生活随笔
收集整理的這篇文章主要介紹了
MySQL中left join、right join与inner join的区别
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1、數據庫
1.1、作者表
?
1.2、圖書表
1.3、出版社表
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、查詢結果
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、查詢結果
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、查詢結果
?
轉載于:https://www.cnblogs.com/bad-robot/p/9788959.html
總結
以上是生活随笔為你收集整理的MySQL中left join、right join与inner join的区别的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 证券之星官方网电脑版(证券之星官方网电脑
- 下一篇: Database学习 - mysql数据