IN operator in SQL return the entire record exact match with given values. For example if we want to match more then one value in our condition for example from table below if we want to select those record who's city is Karachi or Lahore. So we have two way to perform this search:
client_ID | city | order_amount |
A001 | Karachi | 50000 |
A002 | Lahore | 20000 |
B001 | Karachi | 30000 |
B002 | Islamabad | 90000 |
One way is we use simple OR operator using compound statement
SELECT * FROM client_info WHERE city='Karachi' OR city='Lahore' ;
Second way is using IN operator
SELECT * FROM client_info WHERE city IN ('Karachi' , 'Lahore') ;
IN operator match the values from given list.
Select Command
Distinct clause with Select Command
Where clause In SQL
Logical Operator in SQL SELECT Statement
IN Operator in SQL
BETWEEN Operator in SQL
Use of Wildcards in SQL
LIKE Operator in SQL
ORDER BY Clause in SQL
GROUP BY Clause in SQL
HAVING Clause in SQL
ALIAS In SQL
AS Keyword In SQL
INSERT INTO Command In SQL
Inserting Record In to a Table Form an other Table In SQL
UPDATE Command in SQL
DELETE Command in SQL
AVG Function in SQL