How to MySQL Convert String to Lowercase

Haider Ali Feb 15, 2024
How to MySQL Convert String to Lowercase

Want to convert your strings into lowercase and have no idea how to do it effectively? We got you covered for it.

MySQL Convert String to Lowercase

The trick is that MySQL provides a function, namely LCASE() or Lower(). Both of these can be used to convert strings into lowercase letters.

Here’s an example:

Let’s say we have a table friends, which has a column name with two records, AHSAN and SUBTAIN.

Now, let’s select our value.

SELECT * FROM friends;

friends table

You can see the values of capital letters in our column.

Now, we use the Lower() function to convert column records into lowercase.

SELECT LOWER(name) from friends;

lower function

This would do the job perfectly. Also, you can substitute LCASE() for Lower(), which will do the job.

Here’s how:

SELECT LCASE(name) FROM friends;

lcase function

We can use the Lower() function with the Where clause. It will convert the value into lowercase and then compare it with the condition.

Here’s how:

SELECT LOWER(name) FROM friends WHERE name = 'AHSAN';

lower where

Author: Haider Ali
Haider Ali avatar Haider Ali avatar

Haider specializes in technical writing. He has a solid background in computer science that allows him to create engaging, original, and compelling technical tutorials. In his free time, he enjoys adding new skills to his repertoire and watching Netflix.

LinkedIn