MySQL INTERVAL() function returns the index value of the parameter that is greater than the first parameter.
INTERVAL(N,N1,N2,N3,…)
Here, the function compares the first parameter (i.e. N) with the other parameters (i.e. N1, N2, N3, etc.). All parameters are treated as integers. The output it returns is as follows -
The index starts from the second number, that is, from N1, and the first position is 0.
mysql> Select INTERVAL(50,20,32,38,40,50,55); +--------------------------------+ | INTERVAL(50,20,32,38,40,50,55) | +--------------------------------+ | 5 | +--------------------------------+ 1 row in set (0.00 sec)
The output of the above result set is 5 because 55 (the only number greater than 50) has an index value of 5.
The above is the detailed content of What is the MySQL INTERVAL() function?. For more information, please follow other related articles on the PHP Chinese website!