Difference between EXISTS and IN in SQL?

前端 未结 21 1755
执笔经年
执笔经年 2020-11-22 16:50

What is the difference between the EXISTS and IN clause in SQL?

When should we use EXISTS, and when should we use IN

21条回答
  •  爱一瞬间的悲伤
    2020-11-22 17:21

    If you are using the IN operator, the SQL engine will scan all records fetched from the inner query. On the other hand if we are using EXISTS, the SQL engine will stop the scanning process as soon as it found a match.

提交回复
热议问题