SQL NOT IN

The inverse of IN — matches anything NOT in the list.

What & Why

NOT IN keeps rows whose value doesn't appear anywhere in the list.

See How It Works

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
EXAMPLE QUERY
SELECT name FROM marketing.campaigns
WHERE channel NOT IN ('google_ads', 'linkedin');
RESULT
name
Retention Webinar

The result uses the same Queryflo columns shown in the worked example.

Beginner business practice

Sign up free to try it on a real business scenario