MySQL - How to convert character case - UPPER and LOWER functions
Colleagues hello to all.
In today's article, we'll talk about how to convert strings to uppercase and lowercase in a MySQL and MariaDB database.
The case of characters in a database is very important and plays a big role when working with strings. For example, you may need to compare two strings case-insensitively. To solve this case of characters, you can use the built-in functions which are available in MySQL and MariaDB, it UPPER or LOWER. These functions convert the entire string in one operation.
Function UPPER.
Syntax function:
UPPER(string);
The function returns a string in which all characters are converted to uppercase. If NULL values are passed to the function, then the function itself will return NULL.
Just an example of converting a string to uppercase.
sql> SELECT UPPER('hellow world');
Function LOWER.
Syntax function:
LOWER(string);
The function returns a string in which all characters are converted to lower case. If NULL values are passed to the function, then the function will return NULL.
Just an example of converting a string to lowercase.
sql> SELECT LOWER('HELLOW WORLD');
Thank you all, I hope that my article helped you in some way.