array_concat
array_concatβ
array_concat
descriptionβ
Concat all arrays passed in the arguments
Syntaxβ
Array<T> array_concat(Array<T>, ...)
Returned valueβ
The concated array.
Type: Array.
noticeβ
Only supported in vectorized engine
exampleβ
mysql> select array_concat([1, 2], [7, 8], [5, 6]);
+-----------------------------------------------------+
| array_concat(ARRAY(1, 2), ARRAY(7, 8), ARRAY(5, 6)) |
+-----------------------------------------------------+
| [1, 2, 7, 8, 5, 6] |
+-----------------------------------------------------+
1 row in set (0.02 sec)
mysql> select col2, col3, array_concat(col2, col3) from array_test;
+--------------+-----------+------------------------------+
| col2 | col3 | array_concat(`col2`, `col3`) |
+--------------+-----------+------------------------------+
| [1, 2, 3] | [3, 4, 5] | [1, 2, 3, 3, 4, 5] |
| [1, NULL, 2] | [NULL] | [1, NULL, 2, NULL] |
| [1, 2, 3] | NULL | NULL |
| [] | [] | [] |
+--------------+-----------+------------------------------+
keywordsβ
ARRAY,CONCAT,ARRAY_CONCAT