In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Today, I would like to share with you the relevant knowledge of how mysql replaces line breaks. The content is detailed and the logic is clear. I believe most people still know too much about this, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.
In mysql, you can use the char () and REPLACE () functions to replace newline characters; the REPLACE () function can replace newline characters in columns with new strings, which can be expressed as "char (13)" with the syntax "replace (field name, char (13), 'new string')".
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
In mysql, you can use the char () and REPLACE () functions to replace newline characters.
The REPLACE () function is used to replace the newline character in the column with a new string.
Char () is used to indicate the newline character-"char (13)"
Char () can represent not only newline characters, but also carriage returns and horizontal tabs.
Char (9) horizontal tabs
Char (13) enter key
Replace the newline character with an empty character (that is, delete the newline character), you can write
Replace (field name, char (10),'')
Example: replace newline characters in characters with empty characters
SELECT *, REPLACE (detail, CHAR (10),'') AS displays the replaced content
Attached is the ASCII code table:
REPLACE (), which allows you to replace the string in the column of the table with a new string. The syntax is as follows:
REPLACE (str,old_string,new_string)
The REPLACE () function, which takes three arguments, replaces the old_string in string with the new_string string.
It is very important that in the REPLACE function, the first argument is the column name without quotation marks ("). If you enclose quotation marks, such as a field name like" field_name ", the query will update the contents of the column to" field_name ", resulting in unexpected data loss.
The REPLACE function does not support regular expressions, so if you need to replace the text string with a pattern from the external library that requires MySQL user-defined functions (UDF).
These are all the contents of the article "how to change line characters for mysql". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.