SQL IN Operator - SQL IN and NOT IN Operators



Demo wikitechydatabase

  • Below is a selection from the wikitechytable table used in the examples:
sql-in-operator-1

Syntax

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

The SQL IN Operator

  • The IN operator allows you to specify multiple values in a WHERE clause.
  • The IN is a shorthand for multiple OR conditions.
select * from wikitechytable where course IN ('SQL','flutter','Mern')

Output

sql-in-operator-2

NOT IN Operator

  • By using the NOT keyword in front of the IN operator, you return all records that are NOT any of the values in the list.
select * from wikitechytable where course NOT IN ('SQL','flutter','Mern')

Output

sql-not-in-operator-3

Related Searches to SQL IN Operator - SQL IN and NOT IN Operators