开发者

Asking for everything "up to" a value [MySQL]

开发者 https://www.devze.com 2022-12-09 19:57 出处:网络
If I would like to: S开发者_如何学PythonELECT * FROM `Students` ...from age 0 to 20, how would I do this?select * from students where age between 0 and 20

If I would like to:

S开发者_如何学PythonELECT * FROM `Students` 

...from age 0 to 20, how would I do this?


select * from students where age between 0 and 20


SELECT *
FROM   Students
WHERE  Age >= 0 AND Age <= 20

MySQL has many operators from which you can choose.


You should be careful with "between". Different databased treat it differently. For instance in...

age between 0 and 20

... some DBs will gathers people with ages of 0-20 but some will gather people with ages 1-19 and so on.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号