Categories: MySQL Functions

MySQL UPPER() Functions – String Functions

MySQL UPPER() Functions: Syntax

UPPER ( string )

MySQL UPPER() Functions: Description

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”.

Note : This function is multibyte safe.
Tip : UCASE() used within views is rewritten as UPPER().

MySQL UPPER() Functions: Parameter

[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]


MySQL UPPER() Functions: Output

[table caption=”” width=”100%” colwidth=”20%|80%” colalign=”left|left”]
Returns
Uppercase of input string
[/table]


MySQL UPPER() Functions: Available from

[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, MySQL 4.0
[/table]


MySQL UPPER() Functions: Example 1

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 UPPER() Functions: Example 2

mysql> SELECT UPPER('tutorialmines.net') ;
+------------------------------------+
| UPPER('tutorialmines.net') |
+------------------------------------+
| TUTORIALMINES.NET                           |
+------------------------------------+

See all MySQL String functions MySQL 8 String Functions.


Related articles : CONCAT(), CONCAT_WS() , UCASE(), LOWER(), LCASE(), FIELD().


PHP Related articles : STRTOLOWER(), STRTOUPPER(), LCFIRST(), UCFIRST(), UCWORDS(), PHP STRING FUNCTIONS().

jyoti rani

Recent Posts

Modern Toys, Magical Moments: Why the Best Toy Shop in Noida Is More Than Just a Store

When it comes to children, there’s one universal truth: the right toy can spark imagination, build skills, and make memories…

6 months ago

Rediscovering Joy: A New Era of Creativity & Comfort in Toy Stores

In today’s digital age, where screens and gadgets dominate our children’s lives, there’s something heartwarming about a well-loved plush toy…

6 months ago

Unboxing Imagination: Discovering the Joy of Play at a Toy Store in Noida

In a world dominated by screens and fast-paced routines, it’s easy to forget the simple magic of a toy in…

6 months ago

Imagination Unboxed: Discover Joy at the Toy Shop in Delhi

In the heart of Delhi’s vibrant streets lies a world where imagination meets innovation — the magical universe of toys.…

6 months ago

Play with Purpose: Discovering the Ultimate Toy Store in Noida

When was the last time a toy truly amazed you—not just as a product, but as a thoughtful tool for…

6 months ago

From Tears to Toys: Exploring Modern Childhood through Delhi’s Favorite Toy Shop

In the digital age, the way we experience childhood has changed, but the essence remains the same—imagination, exploration, and joy.…

6 months ago