Home > Database > Mysql Tutorial > How to convert value to uppercase in mysql

How to convert value to uppercase in mysql

青灯夜游
Release: 2021-12-07 10:32:18
Original
7615 people have browsed it

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);".

How to convert value to uppercase in mysql

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

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!

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