The Wayback Machine - https://web.archive.org/web/20240603203912/https://www.geeksforgeeks.org/ucase-or-upper-function-in-mysql/
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.
 


Previous Article
Next Article

Similar Reads

LCase() and UCase () Function in MS Access
1. LCase() Function : In MS Access the LCase() function converts the text to lowercase from uppercase. In this function, a string is passed as a parameter and it will return the string in lowercase as a result. Syntax : LCase(text) Example - SELECT LCASE("GeekForGeeks") AS LowercaseName Output - LowercaseName geeksforgeeks Example - SELECT LCASE("G
1 min read
PLSQL | UPPER Function
The PLSQL UPPER function is used for converting all letters in the specified string to uppercase. If there are characters in the string that are not letters, they are unaffected by this function. The char to be converted can be any of the datatypes such as CHAR, VARCHAR2, NCHAR, NVARCHAR2, CLOB, or NCLOB. The value returned by the UPPER function is
2 min read
UPPER() function in SQL Server
UPPER() : This function in SQL Server helps to convert all the letters of the given string to Uppercase. If the given string contains special characters or numeric values, then they will remain unchanged by this function. Syntax : UPPER( str ) Parameters : str - The string which will be converted to uppercase Result : This function will return the
2 min read
SQL UPPER() Function
The SQL UPPER() function is a string function that converts all the strings in the table to uppercase. UPPER() Function in SQLThe UPPER function in SQL is an in-built function that changes lowercase characters or strings to capital cases. Certain characters like integers (0-9) or special characters like ("@", "-" "/", "&" etc.) remain unchanged
4 min read
MySQL | Common MySQL Queries
MySQL server is a open-source relational database management system which is a major support for web based applications. Databases and related tables are the main component of many websites and applications as the data is stored and exchanged over the web. Even all social networking websites mainly Facebook, Twitter, and Google depends on MySQL dat
9 min read
MySQL | LEAD() and LAG() Function
The LEAD() and LAG() function in MySQL are used to get preceding and succeeding value of any row within its partition. These functions are termed as nonaggregate Window functions. The Window functions are those functions which perform operations for each row of the partition or window. These functions produce the result for each query row unlikely
3 min read
MySQL | BIN() Function
The BIN() function in MySQL is used to convert a decimal number to its binary equivalent.The BIN() function is equivalent to the CONV() function written in the format CONV(number,10,2). In this format CONV() function converts the number 'number' from base 10(decimal) to base 2(binary). It is important to note that the BIN() function can only be use
1 min read
MySQL | LAST_DAY() Function
The LAST_DAY() function in MySQL can be used to know the last day of the month for a given date or a datetime. The LAST_DAY() function takes a date value as argument and returns the last day of month in that date. The date argument represents a valid date or datetime. Syntax: LAST_DAY( Date ); If the date or datetime value is invalid, the function
2 min read
CURRENT_TIME() function in MySQL
CURRENT_TIME() function in MySQL is used to check the current time. It returns the current time as a value in 'hh:mm:ss' or hhmmss format, depending on whether the function is used in string or numeric context. Syntax : CURRENT_TIME OR CURRENT_TIME(precision) Parameter : This method accepts one parameter. precision - It specifies the returned fract
2 min read
LOCATE() function in MySQL
LOCATE() function in MySQL is used for finding the location of a substring in a string. It will return the location of the first occurrence of the substring in the string. If the substring is not present in the string then it will return 0. When searching for the location of a substring in a string it does not perform a case-sensitive search. Synta
2 min read
Article Tags :