9952 explained code solutions for 126 technologies

postgresHow to use AND / OR operators

SELECT * FROM person WHERE gender = 'Female' AND (country_of_birth = 'CA' OR country_of_birth = 'US');ctrl + c
SELECT * FROM person

select all columns from table person


filter the results by a condition

gender = 'FEMALE'

first condition

country_of_birth = 'CA'

second condition

country_of_birth = 'US'

third condition


tests both first and second conditions


tests both (first and second conditions) or third condition