Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to remove spaces in mysql

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Xiaobian to share with you how mysql to remove spaces, I hope you have something to gain after reading this article, let's discuss it together!

mysql methods to remove spaces: 1, use replace() function to remove spaces in characters, syntax is "replace(object,','')";2, use trim() function to remove spaces around characters, syntax is "trim ('object')".

Operating environment of this tutorial: Windows 10 system, mysql version 8.0.22, Dell G3 computer.

(1) The mysql replace function

syntax: replace(object,search,replace)

Meaning: Replace all search occurrences in object with replace

Case:

Original data:

Fix statement:

update t_user_score set cname = REPLACE(cname ,' ','') ;

After repair:

(2) The mysql trim function

Grammar:

Full format: TRIM([{BOTH| LEADING | TRAILING} [remstr] FROM] str)

Simplified format: TRIM([remstr FROM] str)

Returns the string str where all remstr prefixes and/or suffixes have been removed. BOTH is assumed if none of the classifiers BOTH, LEADIN, or TRAILING is given. remstr is optional and spaces can be deleted if not specified.

After reading this article, I believe you have a certain understanding of "mysql how to remove spaces". If you want to know more about it, welcome to pay attention to the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report