MySQL UPPER() Function

Definition and Usage

The UPPER() function in MySQL converts a given string to uppercase. This is a useful function for data manipulation, text processing, and ensuring consistency in your data.

Note: UPPER() is functionally identical to the UCASE() function.

Syntax

Syntax

UPPER(text)
            

Parameter Values

Parameter Description
text Required. The string you want to convert to uppercase.

Examples

Example 1: Converting a Literal String to Uppercase

This example converts the string "SQL Tutorial is FUN!" to uppercase.

SQL Query

SELECT UPPER("SQL Tutorial is FUN!");
            
Output

UPPER("SQL Tutorial is FUN!")
-----------------------------
SQL TUTORIAL IS FUN!
            

Example 2: Converting a Column's Values to Uppercase

This example shows how to convert the values in the "CustomerName" column of the "Customers" table to uppercase. The results are aliased as "UppercaseCustomerName".

SQL Query

SELECT UPPER(CustomerName) AS UppercaseCustomerName FROM Customers;
            
Output

-- Output will vary depending on your Customers table. Example:
-- UppercaseCustomerName
-- ------------------------
-- ALFREDS FUTTERKISTE
-- ANA TRUJILLO EMPAR...
-- ...and so on...
            

Technical Details

The UPPER() function is supported in MySQL 4.0 and later versions.