Guides/SQL OR
📘
SQL Guide

SQL OR

Allow rows that match any of several conditions.

What & Why

The OR operator is used to require at least one condition in a WHERE clause to be true. OR broadens a filter. It is useful for alternate categories, fallback criteria, or business rules where multiple paths qualify a row.

See how it works

Find campaigns running on either Google Ads or LinkedIn.

SELECT
  name,
  channel,
  spend
FROM marketing.campaigns
WHERE channel = 'google_ads'
   OR channel = 'linkedin';

Syntax pattern

See explanation
WHERE condition_a
   OR condition_b
  • OR means at least one condition can be true.
  • IN is often cleaner for multiple values on one column.
  • Use parentheses when OR is mixed with AND.
Now You Try

Practice this concept hands-on

Sign up for a free account to run SQL against real datasets right here in the browser and get instant AI feedback. No credit card required.

Sign up free