+ 1
What is the use of IN?
2 Answers
+ 28
IN acts as OR in a query.
eg:-
Select * from Customers where Name IN("John","Tom","Jerry");
it will give you all customer details having name John OR Tom OR Jerry.
+ 2
Description
The SQL IN condition (sometimes called the IN operator) allows you to easily test if an expression matches any value in a list of values. It is used to help reduce the need for multiple OR conditions in a SELECT, INSERT, UPDATE, or DELETE statement.
Syntax
expression IN (value1, value2, .... value_n);
Example
SELECT *
FROM customers
WHERE customer_id IN (5000, 7000, 8000, 9000);
Use
An operator is a reserved word or a character used primarily in an SQL statement's WHERE clause to perform operation(s), such as comparisons and arithmetic operations. Operators are used to specify conditions in an SQL statement and to serve as conjunctions for multiple conditions in a statement.