Skip to content

CONCAT()

Function Description

CONCAT() concatenates multiple strings (or only one string) into one string. If all parameters are non-binary strings, the result is a non-binary string. If the argument contains any binary string, the result is a binary string.

If any of the parameters in CONCAT() is NULL, it returns NULL.

Grammar Description

>
CONCAT(str1,str2,...)

Parameter definition

Parameters Description
str1,str2,... Required parameters. Concatenate str1,str2,.. into a string.
Note: If any parameter is NULL, return NULL.

Example

mysql> SELECT CONCAT('My', 'S', 'QL');
+-------------------------+
| concat(My, S, QL) |
+-------------------------+
| MySQL |
+-------------------------+
1 row in set (0.01 sec)

mysql> SELECT CONCAT('My', NULL, 'QL');
+--------------------------+
| concat(My, null, QL) |
+--------------------------+
| NULL |
+--------------------------+
1 row in set (0.00 sec)

limit

CONCAT() currently does not support quotation-marked string parameters and numeric parameters.