PostgreSQL OR

The PostgreSQL OR is a logical operator that allows us to combine two Boolean expressions. It returns TRUE when either of the conditions evaluates to TRUE.

PostgreSQL OR Syntax:

boolean_expression1 OR boolean_expression2

In this syntax, the boolean_expression is any valid Boolean expression that evaluates to true, false, and unknown.

If Both expressions are true, then result set contains the result both true conditions values.
If only one of them is true, true expression values will be the result.
If both expressions are false, then result set contains zero rows.

PostgreSQL OR Syntax:

Below table used for below examples:

1. Find the employees who belongs to deptno 20 and job is ‘CLERK’.

select * from emp where deptno=20 or job='CLERK';

2. Find the employees where name starts with ‘M’ or job is ‘SALESMAN’.

select * from emp where ename like 'M%' or job='SALESMAN';