SQL IN Operator Query


The IN operator allows you to specify multiple values in a WHERE clause.

Syntax

SELECT column_name(s)
FROM table_name
WHERE column_name IN (value1,value2,...);

Example

employee_idemployee_namestate
1Sachin YadavHaryana
2Vinay KumarUP
3Soun KumarHaryana
4Ravi SankarBihar
5Sanjay KumarHP
6Deepak Singh YadavHaryan
7Harsh SinghBihar
8GoluUP
9SandeepPunjab
10Ashwani YadavHaryana
SELECT * FROM employee
WHERE state IN ('Haryana', 'HP');
Output
employee_idemployee_namestate
1Sachin YadavHaryana
3Soun KumarHaryana
5Sanjay KumarHP
6Deepak Singh YadavHaryan
10Ashwani YadavHaryana

Share this article on