CONCAT_WS()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Concatenates and returns the given strings using the specified separator.
USAGE
CONCAT_WS(separator, string[, string] ...)
Argument Name | Description |
---|---|
| The separator to add between adjacent strings |
| One or more strings to concatenate |
DETAILS
CONCAT_WS()
is a string function that returns a string formed by concatenating all the string arguments interposed with the specified separator string.
The function name can be thought of as "concatenate with separator".
The separator is not used if only one string
argument is provided.
Non-string arguments are converted into string arguments, when possible.
Any NULL
string arguments are skipped.
EXAMPLES
SELECT CONCAT_WS('_', 'foo', 'bar', 'baz');
+-------------------------------------+
| CONCAT_WS('_', 'foo', 'bar', 'baz') |
+-------------------------------------+
| foo_bar_baz |
+-------------------------------------+
SELECT CONCAT_WS('', 'foo', NULL, 'bar');
+-----------------------------------+
| CONCAT_WS('', 'foo', NULL, 'bar') |
+-----------------------------------+
| foobar |
+-----------------------------------+