Home  >  Article  >  Database  >  What is the MySQL INTERVAL() function?

What is the MySQL INTERVAL() function?

PHPz
PHPzforward
2023-08-29 09:13:021383browse

MySQL INTERVAL() 函数是什么?

MySQL INTERVAL() function returns the index value of the parameter that is greater than the first parameter.

grammar

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 -

  • If N
  • If N
  • If N

The index starts from the second number, that is, from N1, and the first position is 0.

Example

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!

Statement:
This article is reproduced at:tutorialspoint.com. If there is any infringement, please contact admin@php.cn delete