# NOT IN condition in PostgreSQL

PostgreSQL NOT IN
To filter the results, the PostgreSQL NOT IN condition is used with SELECT, INSERT, UPDATE and DELETE statements to negate the IN conditions.

Syntax:

WHERE expressions NOT IN (value1, value2, .... value_n);


Parameters:
expressions: It is used to specify a column or a field.
value_1, value_2… value_n: They are used to specify the values to be tested against the expressions.

Example:
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 * FROM “STUDENTS” WHERE “NAME” NOT IN (‘Joy’, 'Happy', 'Smiley');

Output:

 ID NAME AGE 4 Tom 15 5 Jerry 10 6 Bruno 6 7 David 8