exist 和 in 的區別

參考地址 :https://www.cnblogs.com/liyasong/p/sql_in_exists.html  

直接上結論:查詢B表時結果集大適合使用select  * from A where exist (select * from B where A.ID = B.ID)

查詢A表時結果集大適合使用select  * from A where A.ID IN (select * from B where A.ID = B.ID)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章