 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What MySQL returns if we use NULL, as both the arguments, as one of the argument and as a separator, in CONCAT_WS() function?
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)
Advertisements
 