In mysql, you can use the uppercase letter conversion function UPPER() to convert all the alphabetic characters in the string to uppercase; the "UPPER(str)" function can return the string str, mapped according to the current character set Change all characters to uppercase.
(Recommended tutorial: mysql video tutorial)
MySQL uppercase letter conversion function UPPER(str) can convert All alphabetic characters in the string str are converted to uppercase.
Returns the string str with all characters mapped according to the current character set changed to uppercase.
[Example] Use the UPPER function to convert all alphabetic characters in the string to uppercase. The input SQL statement and execution results are as follows.
mysql> SELECT UPPER('green'),UPPER('Green'); +----------------+----------------+ | UPPER('green') | UPPER('Green') | +----------------+----------------+ | GREEN | GREEN | +----------------+----------------+ 1 row in set (0.03 sec)
You can see from the results that all alphabetic characters were originally lowercase and were converted to uppercase, such as "green". After conversion, they are "GREEN"; for strings with mixed uppercase and lowercase letters, the uppercase remains unchanged. Lowercase letters are converted to uppercase letters, such as "Green", and then converted to "GREEN".
The above is the detailed content of How to convert string to uppercase in mysql?. For more information, please follow other related articles on the PHP Chinese website!