Search code examples
sqlsql-serversql-in

SQL IN clause which is guaranteed to evaluate to false


Is there any value which I can place in a SQL IN clause which will guarantee that the clause will evaluate to false?

SELECT *
FROM Products
WHERE ProductID IN (???)

Is there anything I could replace ??? with to guarantee no rows will be returned?


Solution

  • Replace with NULL. There is no better guarantee!

    Because no other value can equal to NULL, even NULL itself.

    And this is kinda universal value for any type(as @zohar-peled mentioned).