SQL Or
The SQL OR Operator
Syntax
SELECT column1, column2, …
FROM table_name
WHERE condition1 OR condition2 OR condition3 …;
Example:
The OR operator is used to filter records based on more than one condition, like if you want to return all customers from Germany but also those from Spain:
OR vs AND
The OR operator displays a record if any of the conditions are TRUE.
Get Elvan Tektaş’s stories in your inbox
Join Medium for free to get updates from this writer.
The AND operator displays a record if all the conditions are TRUE.
At Least One Condition Must Be True
The following SQL statement selects all fields from Customers where either City is "London", CustomerName starts with the letter "E" or Country is "Norway":
Combining AND and OR
You can combine the AND and OR operators.
The following SQL statement selects all customers from UKthat starts with a “E” or an “B”.
Make sure you use parenthesis to get the correct result.







