What is IN operator?
- IN operator in a query allows you to have multiple values in a WHERE clause.
- It is used to compare a value to a list of the literal values that have been specified.
- It is used to test whether the value is there in the list provided or not.
- This conditional operator can also be rewritten by using the compound conditions by using the equal operator or combining it with the OR.
- It is easier to read when the testing is to be done for more than two or three values. Example :
To return records of employees staying in Pune and Mumbai.
Select * from employee
Where employee_location IN ('Pune', 'Mumbai');