这里有三个表
  学生表student(sid ,name,fex);  课程表class(classid.calssname);成绩表ff(ffid,sid,classid,result(成绩分数))1,怎么查询大于80分学生的个数并且为男性?
2, 怎么查询平均分小于66并且课程名为物理?
  

解决方案 »

  1.   

    select count(*) from student a,course b,score c where b.calssname='课程名称' and c.result>80 and a.fex='男性'
      

  2.   

    select name from student where  fex='man' and   sid in (select sid from ff where result>80);
      

  3.   

    select classname from class where classid in (select classid from ff  group by classid having avg(result)>60)
      

  4.   

    select count(*) from student a,class b,ff c where c.result>80 and a.fex='男性'
    and a.sid=c.sid and c.classsid=b.classsid
      

  5.   

    [color=#FF00FF][/select count(*) from student a,course b,score c where b.calssname='课程名称' and c.result>80 and a.fex='男性'color]