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.
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.