开发者

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

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜