Home > Database > Mysql Tutorial > How to convert string to uppercase in mysql?

How to convert string to uppercase in mysql?

青灯夜游
Release: 2020-10-20 09:27:24
Original
5371 people have browsed it

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.

How to convert string to uppercase in mysql?

(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)
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template