Convert lowercase letters to uppercase in MariaDB

This article describes two functions that convert lowercase letters to uppercase in MariaDB.

Posted on

In MariaDB, the UPPER() and UCASE() functions are used to convert lowercase characters to uppercase.

Note that UPPER() and UCASE() are equivalent, you can choose either one.

UPPER() example

The following statement converts the string Hello World! to uppercase using the UPPER() function:

SELECT UPPER('Hello World!');

Output:

HELLO WORLD!

UCASE() example

The following statement converts the string Hello World! to uppercase using the UCASE() function:

SELECT UCASE('Hello World!');

Output:

HELLO WORLD!

Database example

The following example demonstrates using the language table from Sakila sample database.

This statement converts language names to uppercase:

SELECT
  name,
  UPPER(name)
FROM language;

Output:

+----------+-------------+
| name     | UPPER(name) |
+----------+-------------+
| English  | ENGLISH     |
| Italian  | ITALIAN     |
| Japanese | JAPANESE    |
| Mandarin | MANDARIN    |
| French   | FRENCH      |
| German   | GERMAN      |
+----------+-------------+

Conclusion

This article discussed two functions that convert lowercase letters to uppercase in MariaDB: UPPER() and UCASE().

If you want to convert letters from uppercase to lowercase, use LOWER() or LCASE().