select * from student where score >= any(select avg(score) from student group by gnum, cnum) order by gnum, cnum, num ;