Beginner

167. Not Equal Operator

Learn how to filter records whose values are different from a specified value.

📘 Lesson 167 of 728 ⏱ 7 min 🎯 Beginner

The not-equal operator checks whether two expressions have different values. SQL commonly supports <> and many systems also support !=.

Business analysis often requires excluding a particular category, status, or value from a dataset.

An analyst may retrieve employees whose status is not Inactive.

SQL
SELECT
    EmployeeName,
    Status
FROM Employees
WHERE Status <> 'Inactive';

Not-equal comparisons are used in filtering, exception reports, quality checks, and business rule analysis.

  • <> is the standard SQL not-equal operator.
  • Many databases also support !=.
  • It is commonly used with WHERE.
  • NULL values require special handling.
  • It is useful for exclusion filters.
What is the SQL not-equal operator?

The standard SQL not-equal operator is <>; many database systems also support !=.

Does <> include NULL values?

No. NULL represents an unknown value and must be handled separately.

Have you finished this lesson?

Introduction to SQL – All Lessons