Operator in SQL

IN Operator in SQL

 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.