MySQL LCASE() Function
The LCASE()
function in MySQL converts a string to lowercase. This is a very common string manipulation function used for data cleaning, standardization, or case-insensitive comparisons.
LCASE(): Definition and Usage
LCASE()
is a simple but effective function for making all characters in a string lowercase. It's often used to ensure consistency in data, especially when comparing strings where the case of letters shouldn't matter.
Synonym: LOWER()
The LOWER()
function is a synonym for LCASE()
; they both perform the same operation.
Syntax
Syntax
LCASE(text)
Parameter Values
Parameter | Description |
---|---|
text |
The string you want to convert to lowercase. This is required. |
Examples
Converting a Literal String
This converts the string "SQL Tutorial is FUN!" to lowercase.
Syntax
SELECT LCASE("SQL Tutorial is FUN!");
Output
sql tutorial is fun!
Converting a Column's Values
This converts the 'CustomerName' column (assuming a 'Customers' table exists) to lowercase and displays the results in a new column called 'LowercaseCustomerName'.
Syntax
SELECT LCASE(CustomerName) AS LowercaseCustomerName
FROM Customers;
Output
LowercaseCustomerName
-----------------------
(Lowercase versions of each CustomerName from the Customers table)