

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
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 is the use of MySQL IFNULL() control flow function?
MySQL IFNULL() control flow function will return the first argument if it is not NULL otherwise it returns the second argument.
Syntax
IFNULL(expression1, expression2)
Here if expression1 is not NULL then IFNULL() will return expression1 otherwise expression2. It will return NULL if both of the arguments are NULL. Following example will exhibit this −
mysql> Select IFNULL(NULL,'Ram'); +--------------------+ | IFNULL(NULL,'Ram') | +--------------------+ | Ram | +--------------------+ 1 row in set (0.00 sec) mysql> Select IFNULL('Shyam','Ram'); +-----------------------+ | IFNULL('Shyam','Ram') | +-----------------------+ | Shyam | +-----------------------+ 1 row in set (0.00 sec) mysql> Select IFNULL(NULL,NULL); +-------------------+ | IFNULL(NULL,NULL) | +-------------------+ | NULL | +-------------------+ 1 row in set (0.00 sec)
- Related Questions & Answers
- What is the use of MySQL NULLIF() control flow function?
- What would be the default return type of MySQL IFNULL() control flow operator?
- What is the difference between Flow Control and Error Control?
- How does MYSQL control flow function CASE works?
- How MySQL NULLIF() control flow function is similar to CASE statement?
- How can I use IFNULL() function at the place of COALESCE() function in MySQL?
- What is the Flow Control in the Data Link Layer?
- What is the use of MySQL FROM_UNIXTIME() function?
- What is the use of MySQL GET_FORMAT() function?
- What is the use of MySQL LAST_INSERT_ID() function?
- What is the use of MySQL CONCAT_WS() function?
- What is the use of MySQL TRUNCATE() function?
- What is the use of MySQL UNHEX() function?
- What is the use of MySQL SUBSTRING_INDEX() function?
- What is the use of MySQL CHAR() function?
Advertisements