(Contents)(Previous)(Next)

Multiple Conditions: AND, OR

It is possible to retrieve rows which satisfy several conditions combined by AND or OR.

The first example shows customers who live in New York or have a positive account.

SELECT firstname, name, city, account

FROM customer

WHERE city = 'New York' OR account > 0

The second example only shows those customers from New York who have a positive account.

SELECT firstname, name, city, account

FROM customer

WHERE city = 'New York' AND account > 0

See also:

Parentheses with AND and OR


(Contents)(Previous)(Next)