Logical Operators

The logical operators usually are used to combine expressions to get an aggregate Boolean value from the list.

Listing

AND Functions as a logical AND criteria connector.
OR Functions as a logical OR criteria connector.
NOT Functions as a negator.

Notes/Examples

SELECT * FROM payroll WHERE firstname="Bill" AND lastname="Smith"; 
SELECT * FROM payroll WHERE firstname="Bill" OR firstname="Sam"; 
SELECT * FROM payroll WHERE firstname IS NOT NULL; 

Get PostgreSQL Essential Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.