How to Convert Lowercase Characters to Uppercase in MySQL

In MySQL, you can use the UPPER() function to convert any lowercase characters to uppercase. Alternatively, you can use the UCASE() function, which is a synonym for UPPER().

The syntax goes like this:

UPPER(str)

Or…

UCASE(str)

Where str is the string you want converted to uppercase.

Example

Here’s an example:

SELECT UPPER('homer');

Result:

+----------------+
| UPPER('homer') |
+----------------+
| HOMER          |
+----------------+

If the string already contains any uppercase characters, then they will remain uppercase.

Example:

SELECT UPPER('Homer');

Result:

+----------------+
| UPPER('Homer') |
+----------------+
| HOMER          |
+----------------+

Database Example

Here’s an example of selecting data from a database and converting it to uppercase:

USE Music;
SELECT 
    ArtistName AS Original, 
    UPPER(ArtistName) AS Uppercase
FROM Artists
LIMIT 5;

Result:

+------------------+------------------+
| Original         | Uppercase        |
+------------------+------------------+
| Iron Maiden      | IRON MAIDEN      |
| AC/DC            | AC/DC            |
| Allan Holdsworth | ALLAN HOLDSWORTH |
| Buddy Rich       | BUDDY RICH       |
| Devin Townsend   | DEVIN TOWNSEND   |
+------------------+------------------+

The LOWER() and LCASE() functions work the same way to convert characters to lowercase.