select a.sid, avg(a.grade) from score as a join  (select distinct sid from score where sid not in (select distinct(sid) from score where grade <= 80)) as tmp on tmp.sid = a.sid;