Home > Database > Mysql Tutorial > How to modify MySQL fields to capitalize the first letter

How to modify MySQL fields to capitalize the first letter

coldplay.xixi
Release: 2020-09-10 13:22:00
Original
4001 people have browsed it

How to modify the MySQL field to capitalize the first letter: First, use LEFT to remove the first letter separately and use UPPER to capitalize it; then determine the length of the field, and use SBUSTRING to remove all fields from the second to the end for later use; then Use CONCAT to connect the two values ​​above; finally, the value of the update table field can be modified.

How to modify MySQL fields to capitalize the first letter

【Related learning recommendations: mysql tutorial(Video)】

How to modify the MySQL field to capitalize the first letter:

Explanation function:

  • ##CONCAT( str1, str2)Character concatenation function

  • UPPER(str)Change the string to uppercase letters

  • LOWER(str)Change the string to lowercase letters

  • LENGTH(str)Determine the length of the string

  • SUBSTRING(str,a,b)Extract a section of the field, starting from the a-th position of the string str, and extracting b characters

  • LEFT(str,n)Extract the leftmost n characters of the string

  • RIGHT(str,n)Extract characters The rightmost n characters of the string

Ideas:

1. Use LEFT to remove the first letter separately and use UPPER to uppercase it

2. Confirm The length of the field, and use SBUSTRING to remove all fields from the second to the last digit for later use.

3. Use CONCAT to connect the two values ​​above

4. Just update the value of the field in the table.

If you want to know more about programming learning, please pay attention to the

php training column!

The above is the detailed content of How to modify MySQL fields to capitalize the first letter. 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