Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query
optimization, and usability that you won’t want to miss.
CONCAT_WS
stands for concatenation with separator. The first argument is a separator that is placed in between the remaining arguments when concatenating them together. If any of the expressions is NULL it is skipped in the concatenated output.
CONCAT_WS(separator, expression, [ expression, [expression ...]])
The concatenated string.
SELECT CONCAT_WS('a','1','2','3');
+----------------------------+
| CONCAT_WS('a','1','2','3') |
+----------------------------+
| 1a2a3 |
+----------------------------+
SELECT CONCAT_WS('a','1',NULL,'3');
+-----------------------------+
| CONCAT_WS('a','1',NULL,'3') |
+-----------------------------+
| 1a3 |
+-----------------------------+