SQL List Operator

SQL server provides the IN operator that allows the selection of values that match any one of the values in the list. In the same way, the NOT IN operator restricts the selection of values that match any one of the value in the list.


Syntax:
SELECT column_list from table_name WHERE expression list_operator (value_list)

Example: To list all the publishers, who live in State MA or DC, the SELECT statement is:
SELECT Pub_Name, City, FROM Publishers WHERE STATE IN ('MA','DC')

IN Keyword in SQL

SELECT PubName, City, FROM Publishers WHERE STATE NOT IN ('MA','DC')
NOT IN keyword in SQL

Where the SELECT statement extracts only those publishers who do not live in the State of MA or DC.