Mysql data query statement between and contains boundary values
MySQL You can use between in sql statements to limit the range of a data, for example:
select * from user where userId between 5 and 7;
Query users whose userIds are 5, 6, and 7. The userId range includes boundary values, which is also equivalent to the following query:
select * from user where userId >= 5 and userId <= 7;
It is mentioned in many places that between is the given range, which is greater than the first value and less than the second one value, actually this is wrong. I have always thought so before. Through experiments, the conclusion is that the boundary values on both sides are included. If you are really unsure, you can use >= and <= to specify the conditions.
In addition, the range of not between does not include boundary values.
Recommended tutorial: "mysql tutorial"
The above is the detailed content of Does mysql between and contain boundaries?. For more information, please follow other related articles on the PHP Chinese website!