请问从成绩表中选取所有功课成绩大于80分的学生怎么写?

解决方案 »

  1.   

    那不是直接在where 后面加上所有成绩都 > 80 ?
      

  2.   

    SELECT STUDENT_ID
      FROM CHENGJI
     GROUP BY STUDENT_ID, COURSE_ID
    HAVING SUM(TRUNC(SCORE / 80)) = COUNT(1);
      

  3.   

    select sid from students where not exists (select 1 from (select sid from scores where score<=80 and scores.sid=students.sid))
      

  4.   

    select name from table where name not in
    (select distinct(name) from table where 分数 <= 80 )
      

  5.   

    我也来凑热闹,2,3楼都写的很好,两种思想,不过2楼有点缺陷,如果总分不是100分满分,那就有可能不符合了。
    我也写个跟2,3楼思想不同的方法:求其中最小的成绩,如果这个成绩也大于80分,那该学生就满足条件。
    select student_id
      from (select student_id, min(score) as min_score
              from score
             group by student_id)
     where min_score > 80
      

  6.   

    再补充一种方法: select student_id, score
       from (select student_id,
                    score,
                    rank() over(partition by student_id order by score) cc
               from score)
      where cc = 1
        and score >= 80
      

  7.   

    简写一下select student_id, min(score) as min_score
      from score
     group by student_id
    having min(score) > 80今天才知道怎么用插入各种源代码。
      

  8.   

    select student_id, min(score) as min_score
      from score
     group by student_id
    having min(score) > 80
    这个不错
      

  9.   

    就这么简单!select sno
    from SC
    group by sno
    having min(score)>=80
      

  10.   

    所有功课成绩大于80分的学生
    两种理解:
    1.每一门功课的成绩都>80
    6楼答案
    2.任意一门功课的成绩>80