SQL Tutorial SQL Advanced SQL Database SQL References

MySQL LCASE() Function



The MySQL LCASE() function converts all characters of the given string to lowercase. Any symbol, space, or number in the string is ignored while applying this function. Only alphabet are converted.

This function converts the characters using the current character mapping set, which is latin1, by default.

The LCASE() function is a synonym for the LOWER() function.

Syntax

LCASE(string)

Parameters

string Required. Specify the string to convert to lowercase.

Return Value

Returns the string with all characters of the specified string to lowercase.

Example 1:

The example below shows the usage of LCASE() function.

mysql> SELECT LCASE('Learning SQL is FUN!');
Result: 'learning sql is fun!'

mysql> SELECT LCASE('  SQL Tutorial  ');
Result: '  sql tutorial  '

Example 2:

Consider a database table called Employee with the following records:

EmpIDNameCityAgeSalary
1JohnLondon253000
2MarryNew York242750
3JoParis272800
4KimAmsterdam303100
5RameshNew Delhi283000
6HuangBeijing282800

The query given below is used to convert of column City to lowercase.

SELECT *, LCASE(City) AS City_Lowercase FROM Employee;

The query will produce the following result:

EmpIDNameCityAgeCity_Lowercase
1JohnLondon25london
2MarryNew York24new york
3JoParis27paris
4KimAmsterdam30amsterdam
5RameshNew Delhi28new delhi
6HuangBeijing28beijing

❮ MySQL Functions