数据库
首页 > 数据库> > mysql between 包含边界吗?

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)

标签:+----+,set,边界,between,sec,mysql,+-----------+,id
来源: https://www.cnblogs.com/guanchaoguo/p/16480689.html