Combining AND and OR

Filtering Data

SELECT Name, Population
FROM country
WHERE
    (Population > 100000000 OR Population < 2000) AND
    Continent <> 'Asia' AND
    Population > 0


Name Population
Brazil 212,812,405
Cocos (Keeling) Islands 600
Democratic Republic of the Congo 112,832,473
Egypt 118,365,995
Ethiopia 135,472,051
Mexico 131,946,900
Nigeria 237,527,782
...

SQL processes AND operators before OR operators. Therefore, the example uses parentheses to explicitly group related
operators.