In mysql, the concat() function is used to concatenate two or more strings into one string and return it. The syntax is "CONCAT(string1,string2, ... );"; this function At least one parameter is required, otherwise an error will occur. The concat() function converts all parameters to string type before splicing; if any parameter is NULL, the CONCAT() function returns a NULL value.
The operating environment of this tutorial: windows7 system, mysql8 version, Dell G3 computer.
mysql concat() function
Usage: splicing strings
concat() function Concatenates two or more strings into one string and returns it.
The CONCAT() function requires at least one parameter, otherwise an error will occur.
Syntax of CONCAT() function.
CONCAT(string1,string2, ... );
The CONCAT() function converts all parameters to string type before concatenation. If any argument is NULL, the CONCAT() function returns a NULL value.
Example: Splicing two strings MySQL and CONCAT
SELECT CONCAT('MySQL','CONCAT');
If you add a NULL value, the CONCAT function will return a NULL value, as shown below:
SELECT CONCAT('MySQL',NULL,'CONCAT');
[Related recommendations:mysql video tutorial]
The above is the detailed content of How to use mysql concat() function. For more information, please follow other related articles on the PHP Chinese website!