In MySQL, The concat_ws function is a very important MySQL function. The following describes how to use this function. If you are interested in this function, take a look.
How to Use the concat_ws function in MySQL:
CONCAT_WS (separator, str1, str2 ,...)
CONCAT_WS () represents CONCAT With Separator, which is a special form of CONCAT. The first parameter is the delimiter of other parameters. The separator is placed between the two strings to be connected. The delimiter can be a string or another parameter.
Note:
If the Delimiter is NULL, the result is NULL. The function ignores the NULL value after any separator parameter.
For example, separate the strings with commas (,).
Mysql> select concat_ws (',', '11', '22', '33 ');
+ ------------------------------- +
| Concat_ws (',', '11', '22', '33') |
+ ------------------------------- +
| 11,22, 33 |
+ ------------------------------- +
1 row in set (0.00 sec)
Unlike the concat function in MySQL, The concat_ws function does not return NULL because of the NULL value during execution.
Mysql> select concat_ws (',', '11', '22', NULL );
+ ------------------------------- +
| Concat_ws (',', '11', '22', NULL) |
+ ------------------------------- +
| 11,22 |
+ ------------------------------- +
1 row in set (0.00 sec)
MySQL primary key design principles
Advantages of MySQL partitioning
Mysql Partition Table restrictions on Functions
Example of defining MySQL transactions
MYSQL Stored Procedure for incoming and outgoing Parameters