Quote:
|
what is the difference between "IN" and "OR" command in MS SQL?
|
For simple scalar expressions, nothing, though the IN clause is usually less typing. A WHERE clause like:
WHERE somecolumn = 1 OR somecolumn = 2
will result in a query plan that is identical to:
WHERE somecolumn IN (1,2)
Of course, the IN clause is really a 'set contains' operator, so you can construct expressions that are not really feasible with an OR operator, e.g:
WHERE somecolumn IN (SELECT acolumn FROM sometable)