[Sql: exercises 11] query failed two or more courses and students of the school number, name and grade point average

Topic: Query failed two or more courses and students of the school number, name and grade point average

 

Analysis: I think for a long time, I've been thinking of the limitations of student scores table student_score table directly grouping group by, again screening scores

    Can first screened fraction regrouping and having count 

 

sql in the following:

 

select student.id, student.stdentname, AVG(student_score.score) from student,student_score
where
     student.id = student_score.studentid and student_score.score<60
group by student_score.studentid
having count(*)>1;

 

 

 

Guess you like

Origin www.cnblogs.com/yuanyuan2017/p/11328733.html