Get the App
SLTechnology News&Howtos  ›  Database  › 

The method of changing the first letter capitalization of MySQL field

Shulou Source: shulou.com Published: 2022-06-01 04:13:50 10月03日 Update

This article will explain in detail the method of modifying the capitalization of the MySQL field. The editor thinks it is very practical, so I share it with you for reference. I hope you can get something after reading this article.

The method to modify the initial capitalization of the MySQL field is as follows: first, use LEFT to take out the first letter separately and replace it with UPPER for uppercase; then determine the length of the field, and use SBUSTRING to take out all the fields from the second bit to the last bit; then connect the two values above with CONCAT; finally, you can use the value of the update field.

How to change the MySQL field to uppercase:

Explain the function:

CONCAT (str1,str2) character concatenation function

UPPER (str) changes the string to uppercase letters

LOWER (str) changes the string to lowercase letters

LENGTH (str) determines the length of a string

SUBSTRING (str,a,b) extracts a segment of a field, starting with bit an of the string str, extracting b characters

LEFT (str,n) extracts the leftmost n characters of the string

RIGHT (str,n) extracts the rightmost n characters of the string

Train of thought:

1. Use LEFT to take out the initials separately and replace them with UPPER in uppercase

2. Determine the length of the field and use SBUSTRING to take out all the fields from the second bit to the last bit.

3. Connect the two values above with CONCAT

4. The value of the field in the update table is fine.

This is the end of the method of modifying the capitalization of the MySQL field. I hope the above content can be of some help and learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Fields characters letters uppercase strings methods length above two functions more articles spare good practical content right uppercase letters lowercase ideas Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia Microsoft Redmi Xiaomi Linux