NULL as both arguments
MySQL returns blank output if we will use NULL as both of the arguments in CONCAT_WS() function.
Example
mysql> Select CONCAT_WS('',NULL,NULL); +-------------------------+ | CONCAT_WS('',NULL,NULL) | +-------------------------+ | | +-------------------------+ 1 row in set (0.00 sec)
NULL as one of the argument
MySQL returns the value of the other argument as output if we will use NULL as one of the argument in CONCAT_WS() function.
Example
mysql> Select CONCAT_WS('',NULL,'Delhi'); +----------------------------+ | CONCAT_WS('',NULL,'Delhi') | +----------------------------+ | Delhi | +----------------------------+ 1 row in set (0.00 sec) mysql> Select CONCAT_WS('','Ram',NULL); +--------------------------+ | CONCAT_WS('','Ram',NULL) | +--------------------------+ | Ram | +--------------------------+ 1 row in set (0.00 sec)
NULL at the place of separator
MySQL returns NULL as output if we will use NULL at the place of the separator in CONCAT_WS() function.
Example
mysql> Select CONCAT_WS(NULL, 'NEW','DELHI'); +--------------------------------+ | CONCAT_WS(NULL, 'NEW','DELHI') | +--------------------------------+ | NULL | +--------------------------------+ 1 row in set (0.00 sec)