SQL NOT Keyword
The NOT operator is used in a WHERE clause to filter records that do not meet a specified condition. It is commonly used to reverse the result of a logical expression.
SQL NOT Syntax
SELECT column1, column2, ... FROM table_name WHERE NOT condition;
SQL NOT with Equality Example
This query selects all patients whose gender is not female.
SELECT * FROM Patients WHERE NOT gender = 'F';

SQL NOT with IN Example
This query selects all doctors whose specialty is not Cardiology or Pediatrics.
SELECT * FROM Doctors WHERE specialty NOT IN ('Cardiology', 'Pediatrics');

SQL NOT with LIKE Example
This query selects all students whose names do not start with ‘A’.
SELECT * FROM Students WHERE name NOT LIKE 'A%';
