SQL AND

Every condition joined by AND must be true — a single false condition drops the row.

What & Why

AND combines two or more conditions — a row survives only if every condition is true.

See How It Works

BUSINESS QUESTION

Campaigns in google_ads with spend greater than 55,000.

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 and check each rowRow 1 of 4
-- checking Spring Launch: google_ads = google_ads AND 55000 > 55000?FALSE — dropped
namechannelspend
Spring Launchgoogle_ads55000
Retention Webinaremail45000
Finance Retargetinglinkedin50000
Enterprise Searchgoogle_ads60000

channel = 'google_ads' AND spend > 55000 is false for Spring Launch.

EXAMPLE QUERY
SELECT name FROM marketing.campaigns
WHERE channel = 'google_ads' AND spend > 55000;
Now You Try

Practice this concept

Marketing wants active campaigns with at least $1,000 spend.

Available schema
marketing

Prefix tables with marketing.table_name.

namestatusspend
marketing.campaigns
ColumnType
idinteger
nametext
channeltext
spendnumeric
start_datedate
end_datedate
statustext
target_segmenttext
legacy_idtext
query.sql
Beginner business practice

Sign up free to try it on a real business scenario