Concat_ws

Description

Syntax

‘VARCHAR concat ws (VARCHAR sep., VARCHAR str,…)’

Using the first parameter SEP as a connector, the second parameter and all subsequent parameters are spliced into a string. If the separator is NULL, return NULL. The concat_ws function does not skip empty strings, but NULL values.

example

  1. mysql> select concat_ws("or", "d", "is");
  2. +----------------------------+
  3. 124concat ws (or','d','is') 124s;
  4. +----------------------------+
  5. 1.2.2.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.
  6. +----------------------------+
  7. mysql> select concat_ws(NULL, "d", "is");
  8. +----------------------------+
  9. (NULL,'d','is') 1244;
  10. +----------------------------+
  11. No. No. No.
  12. +----------------------------+
  13. mysql > select concat ws ("or", "d", NULL,"is");
  14. +---------------------------------+
  15. Concat ws ("or", "d", NULL,"is").
  16. +---------------------------------+
  17. 1.2.2.2.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.1.
  18. +---------------------------------+

keyword CONCAT_WS,CONCAT,WS