concat_ws

description

Syntax

VARCHAR concat_ws(VARCHAR sep, VARCHAR str,...)

使用第一个参数 sep 作为连接符,将第二个参数以及后续所有参数拼接成一个字符串. 如果分隔符是 NULL,返回 NULL。 concat_ws函数不会跳过空字符串,会跳过 NULL 值

example

1. mysql> select concat_ws("or", "d", "is");
2. +----------------------------+
3. | concat_ws('or', 'd', 'is') |
4. +----------------------------+
5. | doris                      |
6. +----------------------------+

8. mysql> select concat_ws(NULL, "d", "is");
9. +----------------------------+
10. | concat_ws(NULL, 'd', 'is') |
11. +----------------------------+
12. | NULL                       |
13. +----------------------------+

15. mysql> select concat_ws("or", "d", NULL,"is");
16. +---------------------------------+
17. | concat_ws("or", "d", NULL,"is") |
18. +---------------------------------+
19. | doris                           |
20. +---------------------------------+

keyword

CONCAT_WS,CONCAT,WS