MySQL NOT Operator is one of the Logical Operators which is useful in the WHERE Clause to apply filters on the rows returned by SELECT Statement. This operator returns the result as:
- 1, if the operand is zero
- 0, if the operand is 1.
- NULL, If the operand is NULL.
To explain the Logical NOT operator in the WHERE Clause to filter the data, we are going to use the below-shown data.
MySQL NOT Operator Command prompt
In this MySQL example, we pass Zeros, Ones, and Null values with a different combination. This example helps you to understand the Truth table behind the NOT Operator.
SELECT NOT 1; SELECT NOT 0; SELECT NOT NULL; SELECT !1; SELECT !(1 - 1);
USE company; SELECT CustID, First_Name, Last_Name, Education, Profession, Yearly_Income, Sales FROM customers WHERE Education != 'High School';