select 班级,count(*) as 男生人数
from 学生表
where 性别='男'
group by 班级
having count(*)>20
表,sutdents
字段:学号 姓名 性别 班级
s_id name sxe bj
select bj,sum(decode(sex,'女',0,1)) as rs
from students
having sum(decode(sex,'女',0,1))>20
group by bj
select 班级,count(*) 男生人数 from 学生表 where 性别='男' group by 班级 having count(*)>20