Professional Documents
Culture Documents
PreviousNext Chapter
The AND & OR operators are used to filter records based on more than one condition.
The OR operator displays a record if either the first condition OR the second condition is
true.
Demo Database
In this tutorial we will use the well-known Northwind sample database.
CustomerID CustomerName
Country
ContactName Address
City
PostalCode
Alfreds Futterkiste
3
D.F.
Mataderos 2312
Antonio Moreno
Mxico
Thomas Hardy
London
Berguvsvgen 8
WA1 1DP
Lule S-958 22
Example
Try it yourself
OR Operator Example
The following SQL statement selects all customers from the city "Berlin" OR "Mnchen", in
the "Customers" table:
Example
Try it yourself
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 "Mnchen", in the "Customers" table:
Example
Try it yourself