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

What is the MySQL INTERVAL() function?

PHPz
Release: 2023-08-29 09:13:02
forward
1435 people have browsed it

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,…)
Copy after login

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)
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template