SQL UPPER

Converts every letter in a string to uppercase — one of the standard tools for normalizing inconsistent text case.

What & Why

UPPER(text) converts every letter to its uppercase form. Common uses: normalizing text before comparison (so 'IT' and 'it' match), or formatting codes/abbreviations for consistent display.

See How It Works

BUSINESS QUESTION

Marketing wants normalized campaign names and their character length for export QA.

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
  id AS campaign_id,
  UPPER(name) AS uppercase_name,
  LOWER(channel) AS normalized_channel,
  LENGTH(name) AS name_length
FROM marketing.campaigns
ORDER BY campaign_id;
RESULT — exact output from the displayed Queryflo rows
campaign_iduppercase_namenormalized_channelname_length
1SPRING LAUNCHgoogle_ads13
2RETENTION WEBINARemail17
3FINANCE RETARGETINGlinkedin19
4ENTERPRISE SEARCHgoogle_ads17

Case and length functions transform the four displayed campaign strings.

Now You Try

Practice this concept

Marketing wants uppercase campaign names, normalized channel labels, and campaign-name length.

Available schema
marketing

Prefix tables with marketing.table_name.

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

Sign up free to try it on a real business scenario