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. +----------------------------+
  7. mysql> select concat_ws(NULL, "d", "is");
  8. +----------------------------+
  9. | concat_ws(NULL, 'd', 'is') |
  10. +----------------------------+
  11. | NULL |
  12. +----------------------------+
  13. mysql> select concat_ws("or", "d", NULL,"is");
  14. +---------------------------------+
  15. | concat_ws("or", "d", NULL,"is") |
  16. +---------------------------------+
  17. | doris |
  18. +---------------------------------+

keyword CONCAT_WS,CONCAT,WS