實際上,當(dāng)且僅當(dāng) CONCAT_WS() 函數(shù)的第一個參數(shù)(即分隔符)為 NULL 時,它才返回 NULL。一個例子如下 –
mysql> Select CONCAT_ws(NULL,'Tutorial','Point','.com'); +-------------------------------------------+ | CONCAT_ws(NULL,'Tutorial','Point','.com') | +-------------------------------------------+ | NULL | +-------------------------------------------+ 1 row in set (0.00 sec)
登錄后復(fù)制
否則,如果我們在鏈接字符串時將 NULL 放置在 CONCAT_WS() 函數(shù)中的任何其他位置,MySQL CONCAT_WS() 函數(shù)將忽略 NULL。以下示例將展示它 –
mysql> Select CONCAT_ws('s','Tutorial','Point','.com',NULL); +-----------------------------------------------+ | CONCAT_ws('s','Tutorial','Point','.com',NULL) | +-----------------------------------------------+ | TutorialsPoints.com | +-----------------------------------------------+ 1 row in set (0.00 sec) mysql> Select CONCAT_ws('s','Tutorial',NULL,'Point','.com'); +-----------------------------------------------+ | CONCAT_ws('s','Tutorial',NULL,'Point','.com') | +-----------------------------------------------+ | TutorialsPoints.com | +-----------------------------------------------+ 1 row in set (0.00 sec)
登錄后復(fù)制
以上就是在鏈接字符串時,如果我添加 NULL 值,那么 CONCAT_WS() 函數(shù)的輸出是什么?的詳細(xì)內(nèi)容,更多請關(guān)注www.92cms.cn其它相關(guān)文章!