Home >Database >Mysql Tutorial >What will MySQL return if we use NULL as parameter, one of the parameters, and delimiter in CONCAT_WS() function?
If we use NULL as two parameters in CONCAT_WS() function, MySQL will return blank output.
mysql> Select CONCAT_WS('',NULL,NULL); +-------------------------+ | CONCAT_WS('',NULL,NULL) | +-------------------------+ | | +-------------------------+ 1 row in set (0.00 sec)
If we use NULL as one of the parameters in the CONCAT_WS() function, MySQL will return the value of the other parameter as output .
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)
If we use NULL at delimiter in CONCAT_WS() function, MySQL will return NULL as output.
mysql> Select CONCAT_WS(NULL, 'NEW','DELHI'); +--------------------------------+ | CONCAT_WS(NULL, 'NEW','DELHI') | +--------------------------------+ | NULL | +--------------------------------+ 1 row in set (0.00 sec)
The above is the detailed content of What will MySQL return if we use NULL as parameter, one of the parameters, and delimiter in CONCAT_WS() function?. For more information, please follow other related articles on the PHP Chinese website!