Skip to content
SQLSimplified
string

UPPER()

Converts all characters in a string to uppercase.

Description

UPPER converts every letter in a string to its uppercase form. It's the mirror image of LOWER, and it's often used for display formatting or for normalizing text before comparing it.

Syntax

UPPER(string)

Parameters

NameDescriptionOptional
stringThe text value or column to convert. Non-letter characters (numbers, punctuation) are left unchanged.No

Return Type

UPPER returns a VARCHAR (text) value.

Examples

Store (Customers/Orders/Products)

Loading database engine...

Store (Customers/Orders/Products)

Loading database engine...

UPPER is handy for consistent grouping

If the city column has inconsistent capitalization across rows (like 'boston' and 'Boston'), grouping by UPPER(city) instead of city merges them into one consistent bucket.

Common Mistakes

  • Expecting UPPER to permanently change stored data. It only affects the value in the query result, not what's saved in the customers table.
  • Applying UPPER to non-text data without casting. Numeric or date columns need an explicit CAST to text before UPPER will work on them in most databases.
  • Using UPPER purely for display when a case-insensitive comparison operator or collation would be simpler. Sometimes the cleaner fix is a case-insensitive WHERE clause rather than transforming every value.

See also: LOWER, CONCAT, SUBSTRING.

Search

Search lessons, functions, examples, and practice problems