bugl
bugl
HomeLearnPatternsSearch
HomeLearnPatternsSearch

Loading lesson path

Learn/SQL/SQL Tutorial
SQL•SQL Tutorial

SQL OR Operator

Concept visual

SQL OR Operator

Pointer walk
two pointers
leftright102132436485116
left=0
right=6
1
3

Start at both ends

The SQL OR Operator

The WHERE

clause can contain one or more OR operators.

The OR

operator is used to filter records based on more than one condition.

Note:

The OR

operator displays a record if any of the conditions are TRUE. The following SQL selects all customers from Germany OR Spain:

Example

Select all customers where Country is "Germany" OR "Spain":

SELECT *

FROM Customers

WHERE Country = 'Germany' OR Country = 'Spain';

OR Syntax

Select

column1, column2, ...

From

table_name

Where

condition1 OR condition2 OR condition3 ...

;

Demo Database

Below is a selection from the

Customers table used in the examples:

CustomerID

CustomerName

ContactName

Address

City

PostalCode

Country

Alfreds Futterkiste

Maria Anders

Obere Str. 57

Berlin

12209

Germany

Previous

SQL AND Operator

Next

SQL NOT Operator