MySQL LOWER() and UPPER() Functions

You can use either the MySQL UPPER() or LOWER() functions to format columns in your SQL SELECT statements or you can use these functions in conjunction with the other functions to accomplish different types of formatting.

Note: UCASE() is a synonym for UPPER() and LCASE() is a synonym for LOWER().

The MySQL LOWER() function converts all characters in the specified string to lowercase. If there are characters in the string that are not letters, they are ineffective by this function.
Example : mysql> SELECT LOWER('Arjun');
-> 'arjun'

The MySQL UPPER() function converts all characters in the specified string to uppercase. If there are characters in the string that are not letters, they are ineffective by this function.
Example : mysql> SELECT UPPER('Arjun');
-> 'ARJUN'

The LOWER() AND UPPER() functions will convert the characters using the current character mapping set, which is latin1, by default.

For example if you want to update all the user’s usernames with lowercase versions of the usernames, you can write and run query something similar to below shown


UPDATE users SET username = UPPER( username );
// UPDATE table_name SET column_name = UPPER( column_name );

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

Arjun
I am Arjun from Hyderabad (India). I have been working as a software engineer from last 7+ years, and its my passion to learn new things and implement them as a practice. Aside from work, I likes gardening and spending time with pets.
DMCA.com Protection Status