Not in SQL-
Not operator in SQL negates whatever conditions comes after it. It is never used by itself. It is always used in conjunction with some other operators.
Syntax of Not Operator –
SELECT column1, column2 FROM table_name WHERE NOT condition
Employee table –
Let’s say you want to find all employee that are not from department 10. To do that you have to write.
SELECT * FROM emp WHERE NOT DEPTNO = 10;
The Not here negates the condition that follows it. So instead of matching DEPTNO = 10, it matches anything that is Not 10.
You can also use Not operator like this. Both are equivalent.
SELECT * FROM emp WHERE DEPTNO <> 10;