The not equal operator is used to compare two values and return records where the values are different. SQL commonly supports <> as the standard not-equal operator, while != is also supported by many database systems.
Business analysis often requires excluding a particular category, status, department, or value. The not equal operator provides a simple way to remove unwanted values from query results.
If an analyst wants to find all employees who are not part of the IT department, the not equal operator can be used.
SELECT
EmployeeName,
Department
FROM Employees
WHERE Department <> 'IT';
Not equal conditions are useful for excluding cancelled transactions, inactive customers, specific departments, unwanted categories, and exception records.
- <> is a commonly used SQL not-equal operator.
- != is also supported by many databases.
- The operator returns values that are different.
- It is commonly used with WHERE.
- It can be combined with other conditions.
How do you write not equal in SQL?
The standard SQL operator is <>. Many database systems also support !=.
What does <> mean in SQL?
It means that the two compared values are not equal.