SQL NOT LIKE

The inverse of LIKE — matches text that does NOT fit the pattern.

What & Why

NOT LIKE keeps rows whose text does not match the given pattern.

See How It Works

BUSINESS QUESTION

Find campaigns whose names do not end with 'ing'.

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 name NOT LIKE '%ing';
RESULT
name
Spring Launch
Retention Webinar
Enterprise Search

Finance Retargeting is excluded because its name ends with 'ing'.

Now You Try

Practice this concept

Product wants a feature list that excludes names beginning with Mobile.

Available schema
product

Prefix tables with product.table_name.

nameteamreleased_at
product.features
ColumnType
idinteger
nametext
descriptiontext
teamtext
released_attimestamp with time zone
deprecated_attimestamp with time zone
internal_priorityinteger
query.sql
Beginner business practice

Sign up free to try it on a real business scenario