> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# concat_ws

> Concatenates strings using a specified separator between each argument.

This function uses the first argument sep as the separator which combines the second with the rest to form a string. If the separator is NULL, the result is NULL. concat\_ws does not skip empty strings, but it will skip NULL values.

## Syntax

```Haskell theme={null}
VARCHAR concat_ws(VARCHAR sep, VARCHAR str,...)
```

## Examples

```Plain Text theme={null}
MySQL > select concat_ws("Rock", "Star", "s");
+--------------------------------+
| concat_ws('Rock', 'Star', 's') |
+--------------------------------+
| StarRocks                      |
+--------------------------------+

MySQL > select concat_ws(NULL, "Star", "s");
+------------------------------+
| concat_ws(NULL, 'Star', 's') |
+------------------------------+
| NULL                         |
+------------------------------+
1 row in set (0.01 sec)

MySQL > StarRocks > select concat_ws("Rock", "Star", NULL, "s");
+--------------------------------------+
| concat_ws('Rock', 'Star', NULL, 's') |
+--------------------------------------+
| StarRocks                            |
+--------------------------------------+
1 row in set (0.04 sec)
```

## keyword

CONCAT\_WS,CONCAT,WS


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.