Tech Junkie Blog - Real World Tutorials, Happy Coding!: SQL: The NOT IN Operator

Sunday, September 1, 2019

SQL: The NOT IN Operator

The NOT IN operator in SQL means that you are retrieving records in the database that does not match the values in a comma separated list. In other words it retrieves the inverse of the IN statement by itself. Here is an example of how you can use the IN operator in the products table in the Northwind database.

SELECT * 
FROM Products
WHERE SupplierID NOT IN (1,2)

The above example all the products will be retrieved except for products with SupplierID of 1 or 2, here are the results



SQL results from NOT IN operator


Similar Posts:

1 comment:

Search This Blog