CONCAT () is a string concatenation function
Replace () is a string substitution function
CONCAT (parameter 1, parameter 2,...)
CONCAT (String, FROM_STR,TO_STR)
Returns the string str, where all occurrences of the string from_str are replaced by string to_str.
A derivative function is Concat_ws (separator,string1,string2,...)
The difference between this and concat is that after the connection, there is a separator character separator at the junction. For example:
Update users set HOMEDIR=CONCAT_WS (´/´,´/data/disk1´,´part1´,´user1´) where Userid=´user1´;
The result is User1 's Homedir=´/data/disk1/part1/user1´.
CONCAT (STR1,STR2,...)
Returns the string that results from concatenating the arguments. Returns NULL if any argument is null. may have one or more arguments. If all arguments are non-binary strings, the result is a non-binary string. If the arguments include any binary strings, the result is a binary string. A numeric argument is converted to its equivalent binary string form; If you are want to avoid so you can use explicit type cast, as with this example:select CONCAT (cast (Int_col as CHAR), Char_ Col
Mysql> Select CONCAT (' My ', ' S ', ' QL ');
-> ' MySQL '
Mysql> Select CONCAT (' My ', NULL, ' QL ');
-> NULL
Mysql> Select CONCAT (14.3);
-> ' 14.3 '