UPPER() functions convert all the characters in a string to uppercase characters according to the current character set mapping.
The default character set is utf8mb4.
UPPER() does not work when applied to binary strings (BINARY, VARBINARY, BLOB). To perform lettercase conversion of a binary string, first convert it to a nonbinary string using a character set appropriate for the data stored in the string. See example 1
For collations of Unicode character sets, UPPER() work according to the Unicode Collation Algorithm (UCA) version in the collation name, if there is one, and UCA 4.0.0 if no version is specified. For example, utf8mb4_0900_ai_ci and utf8_unicode_520_ci work according to UCA 9.0.0 and 5.2.0, respectively, whereas utf8_unicode_ci works according to UCA 4.0.0. See Section 10.10.1, “Unicode Character Sets”.
[table caption=”” width=”100%” colwidth=”15%|30%|55%” colalign=”left|left|left”]
Name, Required /Optional, Description
string,Required, The input string which needs to be converted to uppercase characters.
[/table]
[table caption=”” width=”100%” colwidth=”20%|80%” colalign=”left|left”]
Returns
Uppercase of input string
[/table]
[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, MySQL 4.0
[/table]
This will work in mysql version 8.
mysql> SET @str = BINARY 'Tutorial'; mysql> SELECT UPPER(@str), UPPER(CONVERT(@str USING utf8mb4)); +-------------+------------------------------------+ | UPPER(@str) | UPPER(CONVERT(@str USING utf8mb4)) | +-------------+------------------------------------+ | Tutorial | TUTORIAL | +-------------+------------------------------------+
This will work in previous versions of MySQL :
In the below example UPPER() function will not work with binary variables :
mysql> SELECT UPPER(BINARY 'Tutorial'); +------------------------------------+ UPPER(BINARY 'Tutorial') +------------------------------------+ | 8411711611111410597108 | +------------------------------------+
In below example UPPER() function will work with binary variables using characterset conversion :
mysql> SELECT UPPER(CONVERT(BINARY 'Tutorial' USING utf8mb4)); +-------------------------------------------------------------------+ UPPER(CONVERT(BINARY 'Tutorial' USING utf8mb4)) +-------------------------------------------------------------------+ | TUTORIAL | +--------------------------------------------------------------------+
mysql> SELECT UPPER('tutorialmines.net') ; +------------------------------------+ | UPPER('tutorialmines.net') | +------------------------------------+ | TUTORIALMINES.NET | +------------------------------------+
See all MySQL String functions MySQL 8 String Functions.
App usage is growing steadily without showing any signs of slowing down. Hence, it is no surprise that mobile applications…
As the world has grown more digital, businesses have adapted themselves. An effectual adaptation includes online advertising. Offline advertising styles…
Step into a world where apps dance to the user's tune. Picture Instagram, a photo-sharing sensation that swept the globe.…
COVID-19 has led to a digitalization of lifestyle. As patients are taking their mental and physical health more seriously, healthcare…
Introduction WordPress, an immensely popular content management system (CMS), powers over 40% of the internet. What makes WordPress even more…
For moving companies trying to capture their market share amidst stiff competition, a tip or two about what they can…