MySQL UCASE() Function
The UCASE()
function in MySQL converts a string to uppercase. This is a very common string manipulation function used for data cleaning, standardization, or case-insensitive comparisons.
UCASE(): Definition and Usage
UCASE()
is a simple yet powerful tool for converting text to uppercase. This is particularly useful for ensuring data consistency, especially when comparing strings where letter case shouldn't affect the result. It's functionally identical to the UPPER()
function.
Syntax
Syntax
UCASE(text)
Parameter Values
Parameter | Description |
---|---|
text |
The string you want to convert to uppercase. This is required. |
Examples
Converting a Literal String
This example shows how to convert the sample string "SQL Tutorial is FUN!" to uppercase.
Syntax
SELECT UCASE("SQL Tutorial is FUN!");
Output
SQL TUTORIAL IS FUN!
Converting Values in a Column
This example converts the values in the 'CustomerName' column of the 'Customers' table to uppercase (assuming a table named 'Customers' with a 'CustomerName' column exists).
Syntax
SELECT UCASE(CustomerName) AS UppercaseCustomerName
FROM Customers;
Output
UppercaseCustomerName
-----------------------
(The uppercase versions of all CustomerNames from the Customers table)