SQL MIN

Returns the smallest value in a column — works on numbers, dates, and text alike.

What & Why

MIN(column) finds the smallest value — the lowest number, the earliest date, or the first value alphabetically for text.

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 MIN(spend) AS lowest_spend
FROM marketing.campaigns;
RESULT
lowest_spend
45000.00

Retention Webinar's spend — the smallest of the four.

Now You Try

Practice this concept

SaaS leadership wants the lowest current MRR across all accounts.

Available schema
saas

Prefix tables with saas.table_name.

minimum_mrr
saas.accounts
ColumnType
idinteger
nametext
plantext
mrrnumeric
created_attimestamp with time zone
churned_attimestamp with time zone
countrytext
employee_countinteger
industrytext
customer_segment_v2text
query.sql
Beginner business practice

Sign up free to try it on a real business scenario