Difference between EXISTS and IN in SQL?

前端 未结 21 1747
执笔经年
执笔经年 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:29

    In certain circumstances, it is better to use IN rather than EXISTS. In general, if the selective predicate is in the subquery, then use IN. If the selective predicate is in the parent query, then use EXISTS.

    https://docs.oracle.com/cd/B19306_01/server.102/b14211/sql_1016.htm#i28403

提交回复
热议问题