SQL BETWEEN

Checks an inclusive range — both endpoints count as a match.

What & Why

BETWEEN low AND high is shorthand for column >= low AND column <= high — both endpoints are included.

See How It Works

BUSINESS QUESTION

Campaign spend values from 45,000 to 55,000, inclusive.

idnamechannelspendstart_dateend_datestatustarget_segment
1Spring Launchgoogle_ads55000.002024-01-152024-03-31activesmb
2Retention Webinaremail45000.002024-02-102024-04-15activeenterprise
3Finance Retargetinglinkedin50000.002024-03-122024-05-31activeenterprise
4Enterprise Searchgoogle_ads60000.002024-04-012024-06-30activeenterprise
Watch between check each rowRow 1 of 4
-- checking Spring Launch: 55000 between 45000 and 55000?TRUE — kept
namespend
Spring Launch55000
Retention Webinar45000
Finance Retargeting50000
Enterprise Search60000

spend BETWEEN 45000 AND 55000 is true for Spring Launch.

EXAMPLE QUERY
SELECT name, spend FROM marketing.campaigns
WHERE spend BETWEEN 45000 AND 55000;
Beginner business practice

Sign up free to try it on a real business scenario