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.
| 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,
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_id | uppercase_name | normalized_channel | name_length |
|---|---|---|---|
| 1 | SPRING LAUNCH | google_ads | 13 |
| 2 | RETENTION WEBINAR | 17 | |
| 3 | FINANCE RETARGETING | 19 | |
| 4 | ENTERPRISE SEARCH | google_ads | 17 |
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
marketingPrefix tables with marketing.table_name.
campaign_iduppercase_namenormalized_channelname_lengthmarketing.campaigns| Column | Type |
|---|---|
| id | integer |
| name | text |
| channel | text |
| spend | numeric |
| start_date | date |
| end_date | date |
| status | text |
| target_segment | text |
| legacy_id | text |
query.sql
Sign up free to try it on a real business scenario