mysql between 包含边界吗?

很多时候需要卡一个区间 就要判断包含边界情况 先说答案 包含

版本

mysql> SELECT VERSION();
+-----------+
| VERSION() |
+-----------+
| 5.7.26    |
+-----------+
1 row in set (1.06 sec)
对象 :业务主键
mysql> select id from  alarm_detector;
+----+
| id |
+----+
|  1 |
|  2 |
|  3 |
|  4 |
+----+
4 rows in set (0.06 sec)

查询 between

mysql> SELECT id  from alarm_detector WHERE id BETWEEN 1 and 4;
+----+
| id |
+----+
|  1 |
|  2 |
|  3 |
|  4 |
+----+
4 rows in set (0.03 sec)
posted @ 2022-07-15 11:22  vx_guanchaoguo0  阅读(56)  评论(0编辑  收藏  举报