- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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