This function is used to return a string concatenated from multiple input strings that are separated by specified separators.
concat_ws(string <separator>, string <str1>, string <str2>[,...])
or
concat_ws(string <separator>, array<string> <a>)
Returns the result of joining all the strings in the parameters or the elements in an array using a specified separator.
Parameter |
Mandatory |
Type |
Description |
---|---|---|---|
separator |
Yes |
STRING |
Separator of the STRING type |
str1, str2 |
Yes |
STRING |
At least two strings must be specified. The value is of the STRING type. If the value is of the BIGINT, DECIMAL, DOUBLE, or DATETIME type, the value is implicitly converted to the STRING type for calculation. |
a |
Yes |
ARRAY |
The elements in an array are of the STRING type. |
The return value is of the STRING or STRUCT type.
select concat_ws(':','avg',null,'18');