Beginner

353. Not Equal Operator

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

📘 Lesson 353 of 728 ⏱ 8 min 🎯 Beginner

The not-equal operator checks whether two expressions have different values. Common SQL syntax includes <> and, in many databases, !=.

Not-equal filtering is useful when a business requirement needs to exclude a specific category, status, or value.

Find employees who are not working in the IT department.

SQL
SELECT
    EmployeeName,
    Department
FROM Employees
WHERE Department <> 'IT';

It is useful for excluding cancelled transactions, inactive customers, specific departments, or unwanted categories.

  • The standard not-equal operator is <>.
  • Many databases also support !=.
  • It excludes matching values.
  • It can be combined with other conditions.
  • NULL values require separate consideration.
What is the SQL not-equal operator?

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

Does <> return rows where the value is NULL?

No. Comparisons involving NULL evaluate as unknown, so NULL values need IS NULL or IS NOT NULL.

Have you finished this lesson?

Introduction to SQL – All Lessons