PostgreSQL NOT
To filter the results, the PostgreSQL NOT condition is used with SELECT, INSERT, UPDATE and DELETE statements to negate a condition.
Syntax:
NOT condition;
Parameters:
condition: It is used to specify the conditions to negate.
Example: Using NOT with LIKE condition.
Students table:
ID | NAME | AGE |
1 | Joy | 5 |
2 | Smiley | 13 |
3 | Happy | 11 |
4 | Tom | 15 |
5 | Jerry | 10 |
6 | Bruno | 6 |
7 | David | 8 |
Query:
SELECT “AGE” FROM “STUDENTS” WHERE “NAME” NOT LIKE 'Dav%'; |
Output:
AGE 5 13 11 15 10