The following is the use of MySQL functions, not exactly, how much to write how much.
Length (str): The character length of the return string (str). A Chinese character is counted as three characters, and a number or letter counts as one character.
Select Length (' test '); -- 6 Select Length ('123abc'); -- 6
char_length (str): The character length of the return string (str). A character, a number, or a letter.
Select char_length (' test '); -- 2 Select char_length ('123abc'); -- 6
InStr (STR,SUBSTR): Returns the position of the first occurrence of the specified string (substr) in the string (str). Returns 0 if it is not found.
SelectInStr'Football','F');--1SelectInStr'Football','o');--2SelectInStr'Football','BA');--5
Locate (SUBSTR,STR): Returns the position of the first occurrence of the specified string (substr) in the string (str). Returns 0 if it is not found.
Select Locate ('ba','football'); -- 5 Select Locate ('o','football'); -- 2
Locate (Substr,str,pos): Returns the position of the first occurrence of the specified string (substr) after the (POS) bit in the string (str). Returns 0 if it is not found.
Select Locate ('o','football',3); -- 3 Select Locate ('o','football', 4); -- 0
concat (str1,str2,...) : returns the string generated by all the parameters that are stitched together. Returns null if any one of the parameter bits is null.
select concat ( " w , " h , " at "); -- what select concat ( " w , " h , " at ", null ); -- null
Concat_ws (separator,str1,str2,...) : returns the string in which all parameters are stitched together, and the first parameter is used as a delimiter for the subsequent argument stitching. If the delimiter is null, NULL is returned, and the other parameter except the delimiter is NULL, is ignored.
SelectConcat_ws (',',' First','Second','Third');--First,second,thirdSelectConcat_ws (';',' One',' A',' -',NULL);--11;22;33SelectConcat_ws (NULL,' One',' A',' -',NULL);--NULL
Left (str,length): Returns a substring of the specified length, starting at the first character of the string (str).
Select Left ('mysql',2); -- my
Right (str,length): Returns a substring of the specified length, starting at the first character of the string (str).
Select Right ('mysql',3); -- SQL
substring (str,pos): Returns a substring of the string (str) that consists of all characters after the start of the (POS) character. POS is positive, starting from left, POS is negative, starting from right.
Select substring ('everyone',3); -- Eryone Select substring ('everyone',-3); -- One
substring (str,pos,length): The return string (str) starts with the (POS) character, A substring that specifies the length of the string after. POS is positive, starting from left, POS is negative, starting from right.
select substring (" everyone ", 1 , 5 ); -- every select substring ( " everyone ' ,
Substring_index (str,delim,count): Returns a substring between the first character of a string (str) and the delimiter (Delim) that appears in the string (count). Count is a positive number, starting from the left, and count is a negative number, starting from the right.
The entire string is returned if the position of the delimiter (Delim) is not found in the string (str), or if the specified number of occurrences (count) is not found. The delimiter (Delim) is not necessarily a symbol, or it can be a custom character.
SelectSubstring_index ('11;22;33;',';',2);--11;22SelectSubstring_index ('11;22;33;',',',2);--11;22;33;SelectSubstring_index ('11;22;33;',';',-2);--;
The use of MySQL functions