The SQL NOT operator returns the opposite of the Boolean value it precedes.  The following truth table shows all combinations of values for the condition (NOT A) 

SQL NOT Operator Truth Table Example

Notice that for the whenever A is TRUE the result is FALSE, and vice versa. 

We can use this to our favor when writing queries.  Consider the situation where you may need to match the opposite of a condition… 

This query returns People not having a FirstName or Gail or John: 

SELECT BusinessEntityId, PersonType, FirstName, LastName FROM Person.Person WHERE NOT (FirstName = 'Gail' or FirstName = 'John')
SELECT BusinessEntityId, PersonType, FirstName, LastName 
FROM   Person.Person 
WHERE  NOT (FirstName = 'Gail' or FirstName = 'John')

SQL NOT Operator Resources 

To learn more about the SQL NOT Operator, check out these useful resources: 

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
>