PostgreSQL NOT

The PostgreSQL NOT condition is used with WHERE clause to Negates a Boolean(TRUE or FALSE) input in a query.

PostgreSQL NOT Syntax:

SELECT column1, column2, ..... columnN FROM table_name WHERE [search_condition] NOT [condition];

PostgreSQL NOT Examples:

Below table used for below examples:

1. Select the all the employees but not belongs to deptno 30.

select * from emp where not deptno=30;

2. Select all employees who is not belongs to deptno 10 and 20.

select * from emp where not deptno=10 and not deptno=20;