mysql內外連接時,on跟where的區別


寫sql的時候經常遇到各種連接查詢,left joinright joininner join,做個筆記

外連接(left join、right join)

left join...on...and...where...and...

on...and...

是對右表中的數據進行篩選,返回的是左表中的所有記錄

where...and...

是對on之后的記錄進行篩選

inner join

inner join...on...and...where...and...

on...and...

是對兩表中的數據進行篩選,返回的是兩表中的所匹配的記錄

where...and...

是對on之后的的記錄進行篩選


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM