
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
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 MySQL Returns if the First Argument of INTERVAL Function is NULL
MySQL returns -1 as output if the first argument of INTERVAL() function is NULL. Following example will demonstrate it −
mysql> Select INTERVAL(NULL,20,32,38,40,50,55); +--------------------------------------+ | INTERVAL(NULL,20,32,38,40,50,55) | +--------------------------------------+ | -1 | +--------------------------------------+ 1 row in set (0.00 sec)
It will return -1 even if any of the other arguments is NULL along with the first argument.
mysql> Select INTERVAL(NULL,20,32,NULL,40,50,NULL); +--------------------------------------+ | INTERVAL(NULL,20,32,NULL,40,50,NULL) | +--------------------------------------+ | -1 | +--------------------------------------+ 1 row in set (0.00 sec)
If the first argument is not NULL and any one or more of the other argument is NULL, it will return the index value of greater number (if any).
mysql> Select INTERVAL(50,20,NULL,55,40,50,NULL); +------------------------------------+ | INTERVAL(50,20,NULL,55,40,50,NULL) | +------------------------------------+ | 2 | +------------------------------------+ 1 row in set (0.00 sec)
Advertisements