between用法:
用于where表达式中,选取两个值之间的数据,如:
1 SELECT id FROM user WHERE id BETWEEN value1 AND value2;
当between前面加上not运算符时,表示取value1和value2范围外的值。
1 SELECT id FROM user WHERE id NOT BETWEEN 2 AND 5;
between边界解析:
通过例子可以看出查出来的结果是 2=< id <=5;可见在mysql数据库中,between查出的两个值是闭区间。
时间: 2024-10-11 17:58:54