between用法:

  用于where表达式中,选取两个值之间的数据,如:

 SELECT id FROM user WHERE id BETWEEN value1 AND value2;

  当between前面加上not运算符时,表示取value1和value2范围外的值。

 SELECT id FROM user WHERE id NOT BETWEEN 2 AND 5;

between边界解析:

mysql数据库 BETWEEN 语法的用法和边界值解析-LMLPHP

通过例子可以看出查出来的结果是    2=< id <=5;可见在mysql数据库中,between查出的两个值是闭区间。

05-22 07:15