MySQL LOWER() Functions – String Functions
MySQL LOWER() Functions: Syntax
MySQL LOWER() Functions: Description
LOWER() functions converts all the characters in a string to lowercase characters according to the current character set mapping.
The default character set is utf8mb4.
LOWER() does not work when applied to binary strings (BINARY, VARBINARY, BLOB). To convert lettercase conversion of a binary string, first convert it to a nonbinary string using a character set appropriate for the data stored in the string. See example 1
For collations of Unicode character sets, LOWER() work according to the Unicode Collation Algorithm (UCA) version in the collation name, if there is one, and UCA 4.0.0 if no version is specified. For example, utf8mb4_0900_ai_ci and utf8_unicode_520_ci work according to UCA 9.0.0 and 5.2.0, respectively, whereas utf8_unicode_ci works according to UCA 4.0.0. See Section 10.10.1, “Unicode Character Sets”.
MySQL LOWER() Functions: Parameter
[table caption=”” width=”100%” colwidth=”15%|30%|55%” colalign=”left|left|left”]
Name, Required /Optional, Description
string,Required, The input string which needs to be converted to lowercase characters.
[/table]
MySQL LOWER() Functions: Output
[table caption=”” width=”100%” colwidth=”20%|80%” colalign=”left|left”]
Returns , Lowercase of input string
[/table]
MySQL LOWER() Functions: Available from
[table caption=”” width=”100%” colwidth=”25%|75%” colalign=”left|left”]
Version, MySQL 4.0
[/table]
MySQL LOWER() Functions: Example 1
This will work in mysql version 8.
mysql> SET @str1 = BINARY 'TUTORIAL'; mysql> SELECT LOWER(@str1), LOWER(CONVERT(@str1 USING utf8mb4)); +-------------+------------------------------------+ | LOWER(@str1) | LOWER(CONVERT(@str1 USING utf8mb4)) | +-------------+------------------------------------+ | TUTORIAL | tutorial | +-------------+------------------------------------+
This will work in previous versions of mysql :
In below example LOWER function will not work with binary variables :
mysql> SELECT LOWER(BINARY 'TUTORIAL'); +------------------------------------+ LOWER(BINARY 'TUTORIAL') +------------------------------------+ | 8485847982736576 | +------------------------------------+
In below example LOWER() function will work with binary variables using characterset conversion :
mysql> SELECT LOWER(CONVERT(BINARY 'TUTORIAL' USING utf8mb4)); +-------------------------------------------------------------------+ LOWER(CONVERT(BINARY 'TUTORIAL' USING utf8mb4)) +-------------------------------------------------------------------+ | tutorial | +--------------------------------------------------------------------+
MySQL LOWER() Functions: Example 2
mysql> SELECT LOWER('TUTORIALMINES.NET') ; +------------------------------------+ | LOWER('TUTORIALMINES.NET') | +------------------------------------+ | tutorialmines.net | +------------------------------------+
See all MySQL String functions MySQL 8 String Functions.