CONCAT(str1,str2,...)
CONCAT() string function in mysql returns the string that results from concatenating the all input arguments.
CONCAT may have one or more arguments. If all arguments are nonbinary strings then their result will be a nonbinary string and If the arguments include any binary strings then the result will be a binary string. A numeric argument is converted to its equivalent nonbinary string form.
if any argument is NULL then CONCAT returns NULL.
mysql> select concat('hello','world');
+-------------------------+
| concat('hello','world') |
+-------------------------+
| helloworld |
+-------------------------+
1 row in set (0.00 sec)
mysql> select concat('hello',' ','world');
+-----------------------------+
| concat('hello',' ','world') |
+-----------------------------+
| hello world |
+-----------------------------+
1 row in set (0.00 sec)
mysql> select concat('hello','','world');
+----------------------------+
| concat('hello','','world') |
+----------------------------+
| helloworld |
+----------------------------+
1 row in set (0.00 sec)
mysql> select concat('hello',NULL,'world');
+------------------------------+
| concat('hello',NULL,'world') |
+------------------------------+
| NULL |
+------------------------------+
1 row in set (0.03 sec)
mysql> select concat('17','.3');
+-------------------+
| concat('17','.3') |
+-------------------+
| 17.3 |
+-------------------+
1 row in set (0.00 sec)
mysql> select concat('17','0.3');
+--------------------+
| concat('17','0.3') |
+--------------------+
| 170.3 |
+--------------------+
1 row in set (0.00 sec)
0 Comment(s)