Open In App

UCASE() or UPPER() Function in MySQL

Last Updated : 16 Jun, 2021
Improve
Improve
Like Article
Like
Save
Share
Report

1. UCASE() : 
This function could be used to convert a string to upper-case. This function is similar to the UPPER() function. UPPER()\UCASE() are built-in MySQL function. 

Syntax : 
 

SELECT UCASE(text)

Example – 
 

SELECT UCASE("MySQL on geeksforgeeks is FUN!") AS UpperText;

Output : 

 

UpperText
MYSQL ON GEEKSFORGEEKS IS FUN!

Now, here you will see UPPER function. 

2. UPPER() : 

Syntax : 
 

SELECT UPPER(text)

Example – 
 

SELECT UPPER("MySQL on geeksforgeeks is FUN!") AS UpperText;

Output : 

 

UpperText
MYSQL ON GEEKSFORGEEKS IS FUN!

Dealing with binary string data : 
The UPPER() function does not affect the binary strings such as BINARY, VARBINARY, or BLOB. Hence, to use binary string in the UPPER() function, it needed to convert to the string to non-binary string. 

Example – 
 

SET @str = BINARY 'Geeksforgeeks';

Now, If you want to read binary string used the following syntax given below. 
 

SELECT UPPER(@str), UPPER(CONVERT(@str USING utf8mb4)) AS UpperText;

Output : 

 

UPPER(@str)  UpperText
Geeksforgeeks GEEKSFORGEEKS

Note – 
It is clearly observed from the output, the UPPER() function has no effect on the binary string.
 


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads