MySQL计算年龄< X

时间:2017-03-22 18:00:02

标签: mysql sql

我想计算表中整数大于特定值的所有行。怎么做?

示例:

If the table looks like
(name) |(age)
-------------
Marvin | 25
Bob    | 30
John   | 45

I want to count how many people are younger than 40.

它应该只返回一个整数。

1 个答案:

答案 0 :(得分:2)

SELECT COUNT(1) 从表 年龄< 40