Syntax
INTERVAL(N,N1,N2,N3,...)
Purpose
Returns the comparison result of N with the list N1,N2,... composed of other parameters. In this topic, N~1~, N~2~, ..., and N~n~ represent the parameters N1,N2...,Nn respectively.
Compare N with N~n~ in sequence:
If
NisNULL, returnNULL.If
Nis less than N~1~, return 0.If there exists a positive integer n such that for any positive integer m less than or equal to n,
Nis greater than or equal to N~m~, butNis less than N~n+1~, return n. (If N~m~ isNULL, it is also considered thatNis greater than or equal to N~m~).
Examples
obclient> SELECT INTERVAL(23, 1, 15, 17, 30, 44, 200);
+--------------------------------------+
| INTERVAL(23, 1, 15, 17, 30, 44, 200) |
+--------------------------------------+
| 3 |
+--------------------------------------+
1 row in set
obclient> SELECT INTERVAL(23, 1, 15, 17, NULL, 44, 200);
+----------------------------------------+
| INTERVAL(23, 1, 15, 17, NULL, 44, 200) |
+----------------------------------------+
| 4 |
+----------------------------------------+
1 row in set
obclient> SELECT INTERVAL(23, 1, 15, 17, 30, 17, 200);
+--------------------------------------+
| INTERVAL(23, 1, 15, 17, 30, 17, 200) |
+--------------------------------------+
| 3 |
+--------------------------------------+
1 row in set
