[sql] Difference between EXISTS and IN in SQL?

Which one is faster depends on the number of queries fetched by the inner query:

  • When your inner query fetching thousand of rows then EXIST would be better choice
  • When your inner query fetching few rows, then IN will be faster

EXIST evaluate on true or false but IN compare multiple value. When you don't know the record is exist or not, your should choose EXIST