MariaDB UPPER() Function
In MariaDB, UPPER() is a built-in string function that converts the given string argument to uppercase and returns the result.
MariaDB UCASE() is an alias for UPPER().
If you want to convert a string to lowercase, use the LCASE() or LOWER() function.
MariaDB UPPER() Syntax
Here is the syntax of the MariaDB UPPER() function:
UPPER(str)
Parameters
str-
Required. The string to be processed.
If you do not provide a parameter, MariaDB will report an error: ERROR 1582 (42000): Incorrect parameter count in the call to native function 'UPPER'.
Return value
The UPPER(str) function returns the uppercase form of the specified string.
The UPPER() function returns NULL if the argument str is NULL.
NOTE: UPPER() does not work with binary strings.
MariaDB UPPER() Examples
Basic example
This statement shows the basic usage of the MariaDB UPPER() function:
SELECT UPPER('Hello'), UPPER(NULL);
Output:
+----------------+--------------------------+
| UPPER('Hello') | UPPER(NULL) |
+----------------+--------------------------+
| HELLO | NULL |
+----------------+--------------------------+Here, the UPPER() function will return NULL if the argument is NULL.
database example
This statement displays the first_name columns in the customer table in the Sakila sample database as uppercase:
SELECT UPPER(first_name) `First Name`
FROM customer
LIMIT 5;
Output:
+------------+
| First Name |
+------------+
| MARY |
| PATRICIA |
| LINDA |
| BARBARA |
| ELIZABETH |
+------------+Conclusion
The MariaDB UPPER() function converts a string to uppercase.