MariaDB LOWER() Function
In MariaDB, LOWER()
is a built-in string function that converts the given string parameter to lowercase and returns it.
MariaDB LOWER()
is an alias for LCASE()
.
If you want to convert a string to uppercase, use the UCASE()
or UPPER()
.
MariaDB LOWER()
Syntax
Here is the syntax of the MariaDB LOWER()
function:
LOWER(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 'LOWER'
.
Return value
The LOWER(str)
function returns the lowercase version of the specified string.
The LOWER()
function returns NULL
if the argument str
is NULL
.
NOTE: LOWER()
does not work with binary strings.
MariaDB LOWER()
Examples
Basic example
This statement shows the basic usage of the MariaDB LOWER()
function:
SELECT LOWER('Hello'), LOWER(NULL);
Output:
+----------------+--------------------------+
| LOWER('Hello') | LOWER(NULL) |
+----------------+--------------------------+
| hello | NULL |
+----------------+--------------------------+
Here, the LOWER()
function will return NULL
if the argument is NULL
.
Database example
This statement displays the first_name
column from the actor
table in the Sakila sample database as lowercase:
SELECT LOWER(first_name) `First Name`
FROM actor
LIMIT 5;
Output:
+------------+
| First Name |
+------------+
| penelope |
| nick |
| ed |
| jennifer |
| johnny |
+------------+
Conclusion
The MariaDB LOWER()
function converts a string to lowercase.