#查询名字以“王”开头的学生信息。
#select * from student where sname regexp '^王';
#查询班长表中电话号中出现“98”数字的班长信息。
#select * from monitor where tel regexp '98';
#查询英语系,数学系老师的教师号和教师名。
#select tno,tname from teacher where sdept in('英语系','数学系');
#查询总人数。
#select count(*) from student;
#查询选修了课程的学生人数。
#select count(distinct sno) from sc where grade is not null;
#计算1号课程的学生平均成绩。
#select avg(grade) from sc where cno='1';
#查询选修了1号课程的学生最高分和最低分。
#select max(grade),min(grade) from sc where cno='1';
#查询学号为“10001”的学生的总成绩和平均成绩。
#select sum(grade),avg(grade) from sc where sno='10001';
#查询有考试成绩的人数。
#select count(distinct sno) from sc where grade is not null;
#统计各系教师人数。
#select sdept,count(*) from teacher group by sdept;
#统计学生表中男,女学生人数。
#select count(*) from student group by sex;
#统计每个班级中男,女人数。
#select sclassNo,sex,count(*) from student group by sclassNo,sex;
#统计教师表中系别的副教授人数。
#select sdept,count(*) from teacher where professional='副教授' group by sdept;
#select sdept,count(*),professional from teacher group by sdept,professional having professional='副教授';