Beginner

49. NOT Operator

Learn how the NOT operator reverses a logical condition in SQL.

📘 Lesson 49 of 728 ⏱ 7 min 🎯 Beginner

The NOT operator is a logical operator that reverses the result of a condition. When a condition is TRUE, NOT makes it FALSE, and when the condition is FALSE, NOT makes it TRUE. NOT can be used with conditions and operators such as IN, LIKE, and BETWEEN.

Analysts frequently need to exclude records matching a specific rule. NOT provides a flexible way to express exclusion conditions.

If you want employees who are not in the Finance department, NOT can be used to reverse the department condition.

SQL
SELECT
    EmployeeName,
    Department
FROM Employees
WHERE NOT Department = 'Finance';

NOT is useful for exclusion rules, data-quality checks, customer segmentation, transaction analysis, and exception reporting.

  • NOT reverses a condition.
  • TRUE becomes FALSE and FALSE becomes TRUE.
  • NOT can be used with different SQL operators.
  • NOT is useful for exclusion logic.
  • Complex NOT conditions should be written carefully.
What does NOT do in SQL?

NOT reverses the logical result of a condition.

Can NOT be used with IN?

Yes. NOT IN is commonly used to exclude values from a specified list.

Have you finished this lesson?

Introduction to SQL – All Lessons