对于教学数据库的三个基本表: S(S#,SNAME,AGE,SEX) SC(S#,C#,GRADE) C(C#,CNAME,TE

对于教学数据库的三个基本表: S(S#,SNAME,AGE,SEX) SC(S#,C#,GRADE) C(C#,CNAME,TEACHER) 试用SQL的查询语句表达下列查询: 1)检索“程军”老师所授课程的课程号和课程名。 2)检索年龄大于21的男学生学号和姓名。 3)检索“李强”同学不学课程的课程号。 4)检索至少选修两门课程的学生学号。 5)检索所有姓刘的学生的平均年龄。 6)检索选修课程名为“C语言”的学生学号和姓名。 7)检索选修课程号为K5的学生学号和姓名。 8)在SC表中插入一条新记录(’S5’,’C1’,98)。 9)查询选修了课程但没有成绩的学生学号及课程号。 10)把低于总平均成绩的男生的成绩提高10分。

1)select c#,cname from c where teacher=’程军’ 2)select s#,sname from student where age>21 and sex=’男’ 3)select c# from c where c# not in (select c# from s,sc where s.s#=sc.s# and sname=’李强’) 4) select s# from sc group by s# having count(*)>=2 5)select avg(age) from s where sname like ‘刘%’ 6)select s#,sname from s,sc,c where s.s#=sc.s# and c.c#=sc.c# and cname=’C语言’ 7)select s.s#,sname from s,sc where s.s#=sc.s# and c#=’K5’ 8)insert into sc values (’S5’,’C1’,98) 9)select s#,c# from sc where grade is null 10) update sc set grade=grade+10 where s# in (select s# from sc where grade<(select avg(grade) from sc)) and sex=’男’