- 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
How does MySQL evaluate the expression if the arguments are not equal in NULLIF()?
As we know that MySQL NULLIF() control flow function will return the first argument both the arguments are not the same. The first argument is returned because MySQL evaluates the first argument twice if both of the arguments are not the same.
Example
mysql> Select NULLIF('Tutorialspoint','MySQL'); +----------------------------------+ | NULLIF('Tutorialspoint','MySQL') | +----------------------------------+ | Tutorialspoint | +----------------------------------+ 1 row in set (0.00 sec)
In the above example, as the arguments are not the same hence MySQL evaluates the first argument i.e.’Tutorialspoint’ two times and return it as output.
Advertisements