本帖最后由 ACMAIN_CHM 于 2012-11-12 17:50:18 编辑

解决方案 »

  1.   

    能用一个sql语句查询出所有性别为男总成绩大于500的学生么?成绩表中存储的单个科目的成绩。
      

  2.   

    select s.*
    from 学生表 s,成绩表 r
    where s.学生表的唯一标示=r.学生表的唯一标示
    and s.学生性别='男'
    group by s.学生表的唯一标示
    having sum(r.成绩)>500
      

  3.   

    select a.*
    from student a,score b
    where a.id=b.id
    and s.sex='男'
    group by a.id
    having sum(b.score)>500;
      

  4.   

    select a.* from student a inner join 
    (select id from scord group by id having sum(score)>500) b
    on a.id=b.id
    where sex='男'
      

  5.   

    select * from 学生表 where 学生唯一标示 in(select 学生唯一标示 from 成绩表 where 性别='男' having sum(成绩)>=500) 上面的都把好的写了  我来写一个子查询,速度是慢了点,但是也可以赚分