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.
| id | name | channel | spend | start_date | end_date | status | target_segment |
|---|---|---|---|---|---|---|---|
| 1 | Spring Launch | google_ads | 55000.00 | 2024-01-15 | 2024-03-31 | active | smb |
| 2 | Retention Webinar | 45000.00 | 2024-02-10 | 2024-04-15 | active | enterprise | |
| 3 | Finance Retargeting | 50000.00 | 2024-03-12 | 2024-05-31 | active | enterprise | |
| 4 | Enterprise Search | google_ads | 60000.00 | 2024-04-01 | 2024-06-30 | active | enterprise |
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_id | channel_label |
|---|---|
| 1 | Google_Ads |
| 2 | |
| 3 | |
| 4 | Google_Ads |
INITCAP transforms the stored campaign-channel strings without replacing them.
Sign up free to try it on a real business scenario