In mysql, you can use the UPPER() function to convert values to uppercase. The function of this function is to convert all alphabetic characters in the string to uppercase. The syntax is "SELECT UPPER(str);".
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In mysql, you can use the uppercase letter conversion function UPPER() to convert values to uppercase.
UPPER(str)
can convert all alphabetic characters in the string str to uppercase.
Syntax:
SELECT UPPER(str);
str: Required. The string to be converted
[Example] Use the UPPER function to convert all alphabetic characters in the string to uppercase
mysql> SELECT UPPER('green'),UPPER('Green'); +----------------+----------------+ | UPPER('green') | UPPER('Green') | +----------------+----------------+ | GREEN | GREEN | +----------------+----------------+ 1 row in set (0.03 sec)
As you can see from the result, all the original letters If the characters are lowercase, all are converted to uppercase, such as "green", and the result is "GREEN" after conversion; if the string is a mixture of uppercase and lowercase letters, the uppercase remains unchanged, and the lowercase letters are converted to uppercase letters, such as "Green", and after conversion it is " GREEN".
[Related recommendations: mysql video tutorial]
The above is the detailed content of How to convert value to uppercase in mysql. For more information, please follow other related articles on the PHP Chinese website!