表:
   test(time:char(10),cid:char(8))
   info(sid:char(10),sname:char(12),addr:char(20))
   score(sid:char(10),cid:char(8),time:char(10),grade:int)
   course(cid:char(8),cname:char(20))
含义如下:
    test考试安排表,time为考试时间
    info是考生信息表,sid是考号,sname是姓名,addr是地址
    score是成绩表,grade表示成绩
    course是课程表,cid是课程号,cname是课程名
    考生历次考试的成绩都放在score表中,可能有考生考了多次,也有人从没考过。
问题:
     找出考试时间以10开头的课程考试不及格(grade<60)的考生姓名及课程名称。score表中没有考试时间以10开头的课程的成绩。其实就是安排10月份考试,决定哪些学生应当报考或补考。

解决方案 »

  1.   

    score表中没有考试时间以10开头的课程的成绩。其实就是安排10月份考试,决定哪些学生应当报考或补考。
    这句话不是很明白
    既然没有开头是10的那查啥啊
      

  2.   

    select info.sname,course.cname
    from test,info,score,course
    where test.time like '10%' and score.grade<60 
    and test.time=score.time and test.cid=score.cid and info.sid=score.sid 
    and score.cid=course.cid
      

  3.   

    test是某一年一些考试的时间,比如今年的自考10月24日会考英语。score是以前考试的成绩,今年10月份的成绩当然是没有的。有的考生某门课程可能有补考,所有的考试成绩都在score表中,考试成绩中某课程只要有一次及格了就算该课程及格。有的考生可能一门课也没考,只在info中保留了相关信息。问题就是要找出应该参加10月份考试的考生名单和课程名称。
      

  4.   

    select info.sname,course.cname
    from test,info,score,course
    where test.time like '10%'     
      and test.cid=score.cid 
      and info.sid=score.sid 
      and score.cid=course.cid
      group by infor.sname,course.cname
      having max(score.grade)<60