SQL INITCAP

Capitalizes the first letter of each word, lowercasing the rest — the standard way to format a name for display, regardless of how it was originally entered.

What & Why

INITCAP(text) capitalizes the first letter of each word and lowercases the remaining letters. Here it turns internal campaign channel values such as google_ads and email into consistent report labels.

INITCAP changes only the query output. It does not replace a governed display-name mapping when underscores or abbreviations need custom wording.

See How It Works

BUSINESS QUESTION

Marketing wants campaign channels displayed as report labels.

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,
  INITCAP(channel) AS channel_label
FROM marketing.campaigns
ORDER BY campaign_id;
RESULT — exact output from the displayed Queryflo rows
campaign_idchannel_label
1Google_Ads
2Email
3Linkedin
4Google_Ads

INITCAP transforms the stored campaign-channel strings without replacing them.

Now You Try

Practice this concept

Marketing wants campaign channels displayed as report labels.

Available schema
marketing

Prefix tables with marketing.table_name.

campaign_idchannel_label
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