Tech Junkie Blog: SQL: The NOT IN Operator

Sunday, June 19, 2016

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

1 comment:


  1. Very informative article.Thank you author for posting this kind of article .

    http://www.wikitechy.com/view-article/what-is-sql-operator-with-examples-and-explanation


    Both are really good,
    Cheers,
    Venkat

    ReplyDelete