Open In App

SQL UPPER() Function

Last Updated : 22 Nov, 2025
Comments
Improve
Suggest changes
1 Likes
Like
Report

The UPPER() function is a commonly used SQL string function that converts all lowercase letters in a string to uppercase. It helps maintain consistent text formatting and is useful when performing case-insensitive string comparisons.

  • Converts all alphabetic characters in a string to CAPITAL letters.
  • Numbers and special characters (like @, -, /, &) remain unchanged.
  • UPPER() and UCASE() perform the same operation in most modern databases.
  • This function works across most SQL databases and is easy to use.

Query:

SELECT UPPER('geeksforgeeks') AS Upper_case;

Output:

Screenshot-2025-11-21-173800
  • Converts the string 'geeksforgeeks' into uppercase letters.
  • Displays the result with the column alias Upper_case.

Syntax:

UPPER(input_text);

OR

UPPER(column_name);

Examples of SQL UPPER() Function

Let's look at the examples of UPPER() function in SQL. Check the SQL UPPER function with examples to understand it better. First, let's create a demo database and table on which we use the UPPER function.

Screenshot-2025-11-21-172301
CompanyData Table

Example 1: Convert Character Literal to Uppercase Using SQL Upper Function

In this example, the character x is displayed as-is in the first column, and then converted to uppercase using the UPPER() function in the second column.

Query:

SELECT  "x" as  "BEFORE UPPER() Function" ,  UPPER("x")  as  "AFTER UPPER() Function";

Output:

Screenshot-2025-11-21-171722
  • Shows the original lowercase value x.
  • Converts x to uppercase using UPPER()

Example 2: Convert string to Uppercase using SQL UPPER Function

In this example, the word "Microsoft" is displayed as it is in the first column, and in the second column it is converted to uppercase using the UPPER() function.

Query:

SELECT  "Microsoft"  as  "BEFORE UPPER() Function" ,  UPPER("Microsoft")  as  "AFTER UPPER() Function";

Output:

Screenshot-2025-11-21-171751
  • Displays the original text value.
  • Converts the text to uppercase using UPPER().

Example 3: Using UPPER Function on Mixed Character String

In this example, the value "12@tEsla" is shown as it is in the first column, and in the second column it is converted to uppercase using the UPPER() function. Only alphabetic characters are changed, while numbers and special characters remain unchanged.

Query:

SELECT  "12@tEsla"  as  "BEFORE UPPER() Function" ,  UPPER("12@tEsla")  as  "AFTER UPPER() Function" ;

Output:

Screenshot-2025-11-21-171821
  • Displays the original mixed string.
  • Converts only letters to uppercase while keeping numbers and symbols unchanged.

Example 4: Using SQL UPPER function on a Column

In this example, the UPPER() function is applied to the ID column. The first column displays the original values, while the second column shows the converted uppercase values. Only alphabetic characters are changed, and numbers or special characters remain unchanged.

Query:

SELECT  ID  As  "BEFORE UPPER() Function",
UPPER(ID) As "AFTER UPPER() Function"
FROM CompanyData;

Output:

Screenshot-2025-11-21-173315
  • Displays original values from the ID column.
  • Converts all alphabetic characters to uppercase using UPPER().


Explore