1 -- 查询男生、女生人数 2 SELECT 3 SUM(if(ssex='男', 1, 0)) AS '男生人数' 4 ,SUM(if(ssex='女', 1,0)) AS '女生人数' 5 FROM student;