BETWEEN
This page is part of MariaDB's Documentation.
The parent of this page is: SQL Operators for MariaDB Enterprise Server
Topics on this page:
Overview
Compares the return value of an expression to minimum and maximum arguments. Returns 1 if expression is greater than or equal to the minimum and less than or equal to the maximum, otherwise returns 0.
EXAMPLES
CREATE TABLE between_example (
v1 INT,
v2 INT
);
INSERT INTO between_example VALUES
(0, 9), (1, 8), (2, 7), (3, 6), (4, 5),
(5, 4), (6, 3), (7, 2), (8, 1), (9, 0);
SELECT * from between_example
WHERE v1 BETWEEN 5 AND 7;
+------+------+
| v1 | v2 |
+------+------+
| 5 | 4 |
| 6 | 3 |
| 7 | 2 |
+------+------+
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.