Use of SQL IN Operator

Use of SQL IN Operator

Instructor-svgAl-Mamun Sarkar
Apr 15 , 2020

Use of SQL IN Operator. The following SQL commands show how to use IN operator of SQL while querying with array data. 

 

SQL IN Operator Syntax:

SELECT column, column, ....
FROM table_name
WHERE column_name IN (item, item1, item2, item2);

Example:

SELECT * FROM employees
WHERE country IN ('Germany', 'France', 'UK');

 

SQL IN Operator in for Sub Query:

SELECT column, column, ....
FROM table_name
WHERE column_name IN (SELECT column FROM tablename);

Example:

SELECT * FROM employees
WHERE Country IN (SELECT Country FROM customers);

 

  • Share On:
  • fb
  • twitter
  • pinterest
  • instagram