SQL Server NOT Condition (Operator)
The SQL Server NOT condition or NOT operator is used to negate a condition in a SELECT, INSERT, UPDATE, or DELETE statement.
condition: It specifies the condition that you want to negate.
NOT Operator with IN condition
We have a table "Employees", having the following data:
Retrieve all employees from the table where the following "NOT" condition is satisfied:
NOT Operator with IS NULL condition
Retrieve all employees from the table "Employees" which follows the IS NOT NULL condition:
NOT Operator with LIKE condition
Retrieve all employees from the table "Employees" which follows the NOT LIKE condition. It will display only names which don?t start with "M".
NOT Operator with BETWEEN condition
Retrieve all employees from the table "Employees", which follows the following condition. It will not show the employees between the id 8 to 13.
NOT Operator with EXISTS condition
You can also combine SQL Server NOT condition with the EXISTS condition.
This SQL Server NOT example would return all records from the Employees table where there are no records in the Employee2 table for the matching name and salary.