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

  1. 1. int类型->闭
  2. 2. 时间类型 -> 闭
  • 结论:不论int还是时间类型, between-and都是闭区间[a,b]
  • 1. int类型->闭

    SELECT pk_id FROM `mutual_exclusion_var_details` where pk_id BETWEEN 10 AND 15;

    pk_id
    10
    11
    12
    13
    14
    15

    2. 时间类型 -> 闭

    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还是时间类型, between-and都是闭区间[a,b]


    [2020-04-10]


    转载请注明来源,欢迎对文章中的引用来源进行考证,欢迎指出任何有错误或不够清晰的表达。可以在下面评论区评论,也可以邮件至 hi@niewj.com

    ×

    喜欢就点赞,疼爱就打赏