Difference between IN and EXISTS
What is the difference between IN and EXISTS? Performance wise which one is better and how?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nitin SontakkePosted Jun 14, 2016, 9:12 AM
Vinay SinghPosted Jun 14, 2016, 7:36 AM
SaurabhPosted Jun 14, 2016, 7:23 AM
Vinay SinghPosted Jun 14, 2016, 7:09 AM
IN -- The inner query is executed first and the list of values obtained as its result is used by the outer query.The inner query is executed for only once.
EXISTS -- The first row from the outer query is selected ,then the inner query is executed and , the outer query output uses this result for checking.This process of inner query execution repeats as many no.of times as there are outer query rows. That is, if there are ten rows that can result from outer query, the inner query is executed that many no.of times.