mysql between-and是[a,b]闭区间

  • int类型
SELECT pk_id FROM `mutual_exclusion_var_details` where pk_id BETWEEN 10 AND 15;
pk_id
10
11
12
13
14
15
  • 时间类型
SELECT time_inst FROM `eca01_basic` where time_inst BETWEEN '2019-03-06 17:07:41' and '2019-03-07 10:49:05' ;
time_inst
2019-03-06 17:07:41
2019-03-06 17:10:07
2019-03-06 17:19:26
2019-03-06 18:12:04
2019-03-06 18:19:19
2019-03-06 18:19:39
2019-03-06 18:59:06
2019-03-07 10:48:00
2019-03-07 10:49:05
可见, 不论int还是时间类型, mysql的between-and都是闭区间[a,b]

[2020-04-10]

你可能感兴趣的:(sql,mysql)