The table content is as follows: query IDselectstuid, max (score) fromstu_select_class, and query the selectstuid and sum (score) fromstu_select_classgroupbystuidlimi tables with a total score of 2-3 in each subject:
// Query the person ID with the highest score
Select stuid, max (score) from stu_select_class;
// Query the total number of students in each subject.
Select stuid, sum (score) from stu_select_class group by stuid limit 1, 2;
// Query the highest score for each subject
Select classname, stuid, max (score) from stu_select_class group by classname;
// Students whose total query score is less than 140
Select stuid, sum (score) from stu_select_class group by stuid having sum (score) <140;
// The average score of the query is between 60 and 80.
Select stuid, avg (score) from stu_select_class group by stuid having avg (score) between 60 and 80;
// Query .... Students
Select stuid, sum (score), avg (score) from stu_select_class group by stuid having sum (score) <140 and avg (score) <80;
// Query the total score .. Number of students.
Select distinct count (stuid) from stu_select_class group by stuid having sum (score) <140 and avg (score) <80;
// Query... Number of students
Select count (distinct stuid) from stu_select_class where classname = 'hangzhou' and score <100;