Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in SQL by (55.6k points)

Can anyone tell me how to use in operator in SQL?

1 Answer

0 votes
by (119k points)

We use ‘IN’ operator to check whether the records exist in the subquery. IN operator can also be used instead of multiple OR conditions in WHERE clause.

Here is the syntax to use IN operator in SQL:

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

OR

SELECT column_list
FROM table_name
WHERE column_name IN (SELECT STATEMENT);

Here is the statement to find the employees whose location is ‘Bangalore’, ‘Hyderabad’, ‘Chennai’:

SELECT * FROM Employee
WHERE Country IN (Bangalore’, 'Hyderabad', ‘Chennai’);

You can check out this SQL Tutorial blog to learn more about SQL operators with examples.

Related questions

0 votes
1 answer
asked Jul 23, 2019 in SQL by Tech4ever (20.3k points)
0 votes
1 answer
asked Mar 14, 2021 in SQL by dev_sk2311 (44.4k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...