S2 第一本書 第四章 上機練習1-4
阿新 • • 發佈:2019-01-31
--------上機練習1------ select max(StudentResult),min(StudentResult) from result where examdate= ( select max(examdate) from result where subjectid= ( select subjectid from subject where subjectname='oop' ) ) and subjectid= ( select subjectid from subject where subjectname='oop' ) ----上機練習2------ select subjectname from subject where gradeid in (select gradeid from grade where gradename='S1') ----上機3---- select studentname,studentno from student where studentno not in( select studentno from result where subjectid=( select subjectid from subject where subjectname='oop' ) and examdate=( select max(examdate) from result where subjectid=(select subjectid from subject where subjectname='oop') ) )and gradeid=(select gradeid from grade where gradename='S1') -----上機4----- if exists ( select * from student where gradeid=(select gradeid from grade where gradename='S1') ) begin update student set gradeid='2' where gradeid='1' end