MariaDB LCASE() Function

In MariaDB, LCASE() is a built-in string function that converts the given string parameter to lowercase and returns it.

MariaDB LCASE() is an alias for LOWER().

If you want to convert a string to uppercase, use the UCASE() or UPPER() function.

MariaDB LCASE() Syntax

Here is the syntax of the MariaDB LCASE() function:

LCASE(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 'LCASE'.

Return value

The LCASE(str) function returns the lowercase version of the specified string.

The LCASE() function returns NULL when the argument str is NULL.

NOTE: LCASE() does not work with binary strings.

MariaDB LCASE() Examples

Basic example

This statement shows the basic usage of the MariaDB LCASE() function:

SELECT LCASE('Hello'), LCASE(NULL);

Output:

+----------------+--------------------------+
| LCASE('Hello') | LCASE(NULL)              |
+----------------+--------------------------+
| hello          | NULL                     |
+----------------+--------------------------+

Here, the LCASE() function returned NULL when 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 LCASE(first_name) `First Name`
FROM actor
LIMIT 5;

Output:

+------------+
| First Name |
+------------+
| penelope   |
| nick       |
| ed         |
| jennifer   |
| johnny     |
+------------+

Conclusion

The MariaDB LCASE() function converts a string to lowercase.