If the column is indexed then no difference but if the column is not indexed then the In would be faster than OR because it first sort the record then apply the binary search.
Almost no difference.. Just checked it on 65000 rows with random values.
Values are compared separately at run time whether they are using IN CLAUSE or using OR CLAUSE in query sql server usage same mechanism for both.
Because While you use "OR" condition that means your sql select two set of record of index while "IN" is select one record set as per index
IN query is fast rather then OR condition.
They have difference in Argument types.
Is any valid expression.
Is a subquery that has a result set of one column. This column must have the same data type as test_expression.
expression[ ,... n ]
Is a list of expressions to test for a match. All expressions must be of the same type as test_expression.
Is any valid expression that returns TRUE, FALSE, or UNKNOWN.
© 2016 C# Corner. All contents are copyright of their authors.
C# Corner. All contents are copyright of their authors.