CONCAT()

Description

This function CONCAT() returns the string that results from concatenating the arguments. May have one or more arguments. If all arguments are nonbinary strings, the result is a nonbinary string. If the arguments include any binary strings, the result is a binary string.

CONCAT() returns NULL if any argument is NULL.

Syntax

1. >
2. CONCAT(str1,str2,...)

Arguments

Arguments Description
str1,str2,… Required. The str to add together. Note: If any of the strs is a NULL value, it returns NULL.

Examples

1. mysql> SELECT CONCAT('My', 'S', 'QL');
2. +-------------------+
3. | concat(My, S, QL) |
4. +-------------------+
5. | MySQL             |
6. +-------------------+
7. 1 row in set (0.01 sec)

9. mysql> SELECT CONCAT('My', NULL, 'QL');
10. +----------------------+
11. | concat(My, null, QL) |
12. +----------------------+
13. | NULL                 |
14. +----------------------+
15. 1 row in set (0.00 sec)

Constraints

Currently, CONCAT() doesn’t support quoted strings and numeric argument.