sql语句做统计怎样写代码高手进来看啊!

来源:百度知道 编辑:UC知道 时间:2024/05/27 04:39:02
例:统计出tab_user 表中属于(男)的有多少人啊!
统计出tab_user 表中属于(年龄)在15-25的有多少人啊!
统计出tab_user 表中属于(年龄)在30-40的有多少人啊!
怎样输出!
大概写出代码
男总计( )多少人怎样输出
显示页只显示人数()务请不吝赐教.

1. select count(*) from tab_user where gender = 'm'
2. select count(*) from tab_user where age >= 15 and age <= 25
3. select count(*) from tab_user where age >= 30 and age <= 40

select count(*) form tab_user where sex='男'
select count(*) form tab_user where (age>15 and age<25)

SELECT COUNT(*) FROM tab_user WHERE 性别='男'
SELECT COUNT(*) FROM tab_user WHERE 年龄>=15 AND 年龄<=25
SELECT COUNT(*) FROM tab_user WHERE 年龄>=30 AND 年龄<=40