SELECT * FROM `student`
SELECT count(*) as '人数' FROM student ;
SELECT SUM(exam) as '总成绩' FROM schooldb where studentid='2011001003';
SELECT avg(exam) as '平均分' FROM schooldb WHERE studentid='2011001004';
SELECT max(exam) as '最大值',min(exam)as '最小值',avg(exam) as '平均值' FROM schooldb WHERE subjectid=2;
SELECT AVG(exam) as '平均分' FROM schooldb WHERE subjectid=1 and exam>60;
//....
SELECT sex,count(*) as '人数',addres FROM student GROUP BY sex,addres HAVING sex='男' and count(*)>2;
SELECT count(*) as '人数',gid FROM student GROUP BY gid HAVING count(*)>8;