OR Operator

In PostgreSQL, a boolean value can have one of three values: true, false, and null.

Result

true

true

t

true

'true'

true

'y'

true

'yes'

true

'1'

true

false

false

f

false

'false'

false

'n'

false

'no'

false

'0'

false

Postgres OR Operator Query Results

SELECT true OR true AS result;

true

SELECT true OR false AS result;

t

SELECT true OR null AS result;

t

SELECT false OR false AS result;

f

SELECT false OR null AS result;

null

SELECT false OR false AS result;

f

SELECT null OR null AS result;

null

Using the OR operator in the WHERE clause

The following example uses the OR operator in the WHERE clause to find the films that have a rental rate is 0.99 or 2.99

Output:

Last updated