內連接查詢 (select * from a join b on a.id = b.id) 與 關聯查詢 (select * from a , b where a.id = b.id)的區別

1.首先了解 on 、where 的執行順序以及效率? from a join b 與 from a, b 產生的臨時表結果集 。 都是執行笛卡爾積即(select * from a cross join b )兩表的行乘積數。 on :與取得結果集同步進行數據刷選及過濾。 where : 獲得結果集之後,才進行數據刷選及過濾。 執行順序:on在上游,where在中游,having在下游。 案例:
相關文章
相關標籤/搜索