Search the Whole World Here.,.,

SQL - Combining AND & OR

SQL - Combining AND & OR


You can also combine AND and OR (use parenthesis to form complex expressions).

The following SQL statement selects all customers from the country "Germany" AND the city must be equal to "Berlin" OR "München", in the "Customers" table:

Example

SELECT * FROM Customers
WHERE Country='Germany'
AND (City='Berlin' OR City='München');
Try it Yourself »

SQL - OR Operator Example

SQL - OR Operator Example


The following SQL statement selects all customers from the city "Berlin" OR 

"München", in the "Customers" table: 

Example

SELECT * FROM Customers
WHERE City='Berlin'
OR City='München';
Try it Yourself »

SQL - AND Operator Example

SQL - AND Operator Example


The following SQL statement selects all customers from the country "Germany" AND the city "Berlin", in the "Customers" table:

Example

SELECT * FROM Customers
WHERE Country='Germany'
AND City='Berlin';
Try it Yourself »

Ads by Google