In the project, to determine a certain number of fields in the table, if a value is replaced, using a few typical string operations, the record Note implementation scheme is as follows:Note: If the substitution string is unique, you can use replace,
First, ASCII
ASCII (str)
Returns the ASCII code value of the leftmost character of the string str. If Str is an empty string, returns 0. If STR is NULL, returns NULL.
Second, ORD
ORD (str)
If the string str leftmost character is a multibyte
Suppose you have a table:
Copy Code code as follows:
CREATE TABLE users (id int (6) Not NULL auto_increment,primary KEY (ID), user_name VARCHAR (m) not null,emails VARCHAR (x) T NULL);
Initialize the table and add some
MySQL string functionASCII value of ASCII (char) return characterBit_length (str) returns the bit length of the stringCONCAT (S1,S2...,SN) connects S1,s2...,sn to a stringConcat_ws (SEP,S1,S2...,SN) connects the S1,S2...,SN to a string and uses the
MySQL String Function EncyclopediaFor operations on string positions, the first position is marked as 1.
ASCII (str)
Returns the ASCII code value of the leftmost character of the string str. If Str is an empty string, returns 0. If STR is NULL,
To add a field:ALTER TABLE ' User_movement_log 'Add column Gatewayid int not null default 0 after ' RegionID ' (which field is added later)The MySQL concat function can concatenate one or more strings, such asSelect Concat (' 10 ');Select Concat (' 1
First, common String functions:
1. Char_length Gets the length (in characters)
2. Format formatted
3, insert replace the way inserted
4. INSTR Get Location
5, Left/right take left, take right
6. Length Gets the lengths
First, common String functions:
1. Char_length Gets the length (in characters)
2. Format formatted
3, insert replace the way inserted
4. INSTR Get Location
5, Left/right take left, take right
6. Length Gets the lengths
--The length of the stringSELECT Length (' abc '), Length (' My home ');SELECT char_length (' abc '), Char_length (' my Home ');--Merging stringsSELECT CONCAT (' A ', ' B ', ' C '), Concat_ws (', ', ' A ', ' B ', ' C '), CONCAT (null, ' a '), Concat_
MySQL string intercept function: Left (), right (), substring (), Substring_index (). There is also mid (), substr (). where mid (), substr () is equivalent to the substring () function, the function of substring () is very powerful and flexible.1.
MySQL Replace function we often use, the following gives you a detailed description of the use of MySQL replace function, I hope you learn MySQL Replace function can be enlightened.Recently in the study of CMS, in the data conversion need to use the
DELIMITER $$DROP FUNCTION IF EXISTS ' fun_getpy ' $$CREATE FUNCTION ' his '. ' Fun_getpy '(In_string VARCHAR (21845))RETURNS VARCHAR (21845) CHARSET UTF8BEGIN#截取字符串, each time the truncated string is stored in the variable, the initial function
If the result length is greater than the server parameter max_allowed_packet, the string value function returns NULL. For operations on the string position, the first position is marked as 1. ASCII (str) returns the ASCII code value of the leftmost
String function string comparison function if the result length is greater than the maximum value of the max_allowed_packet system variable, the return value of the string value function is NULL. See section 7.5.2 "Adjust server Parameters ".
String
Welcome to the Linux community forum and interact with 2 million technical staff. If the MySQL database uses the varchar (or char) type at a certain time, this makes it easy for the system to adapt to different database versions without converting
Values (mail_url,. com) whereid169; To be continued, if you have any related information, please add the stored procedure: createPROCEDUREdowhile () BEGINDECLAREiintDEFAULT0; STARTTRANSACTION; values (MAIL_url) values (***
Update table set mail_url
When creating the view today, it is very convenient to use string Truncation in MySQL.
When creating the view today, it is very convenient to use string Truncation in MySQL.
I feel that the string function of MySQL intercepts characters, which is
Generally, the entire string is used as the operation object, for example: search for a substring in a substring, obtain a substring, insert a substring at a certain position in the substring, and delete a substring.
Generally, the entire string is
MySQL provides standard SQL mode matching and an extended regular expression mode matching format based on Unix utilities such as vi, grep, and sed.
MySQL provides standard SQL mode matching and an extended regular expression mode matching format
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.