1. 程式人生 > >Oracle,用left join 替代 exists ,not exists,in , not in,提高效率

Oracle,用left join 替代 exists ,not exists,in , not in,提高效率

.cn rom mage png 高效 pan div sele bsp

Not IN問題

技術分享

Exists,not Exists,in,not in

技術分享

例如:

DELETE FROM YSHA WHERE NOT EXISTS(SELECT 1 FROM YSHB B WHERE YSHA.code=b.code )

等同於

DELETE A FROM YSHA A LEFT JOIN YSHB B ON A.code=b.code WHERE b.code is NULL

Oracle,用left join 替代 exists ,not exists,in , not in,提高效率