查询每个专业的男生人数和女生人数分别是多少
#方式一: select count(*) 个数,sex,majorid from student group by sex,majorid; #方式二: select majorid, (select count(*) from student where sex='男' and majorid=s.majorid)男, (select count(*) from student where sex='女' and majorid=s.majorid)女 from student s group by majorid;