NOT EQUAL TO
Anonymous contributor
Published Aug 26, 2024
Contribute to Docs
In SQL, the NOT EQUAL TO
operator is used to compare two values. It returns true if the values are not equal and false if they are equal. The operator can be represented in two ways: <>
or !=
.
Syntax
-- Using the <> operator
SELECT column1, column2, ...
FROM table_name
WHERE column_name <> value;
-- Using the != operator
SELECT column1, column2, ...
FROM table_name
WHERE column_name != value;
Example
The given query will select all employees who are not in the Sales
department using the NOT EQUAL TO
operator.
SELECT *FROM employeesWHERE department <> 'Sales';
All contributors
- Anonymous contributor
Contribute to Docs
- Learn more about how to get involved.
- Edit this page on GitHub to fix an error or make an improvement.
- Submit feedback to let us know how we can improve Docs.