对于教学数据库的三个基本表: 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)检索年龄大于20岁的女学生的姓名和性别。 3)检索学号为S3的学生所学课程的课程号与成绩。 4)检索WANG同学不学的课程的课程号。 5)统计每门课程的学生选修人数(超过15人的课程才统计)。要求显示课程号和人数,查询结果按人数降序排列,若人数相同,按课程号升序排列。 6)求LIU老师所授课程的每门课程的成绩的最高分和最低分。 7)求年龄大于所有女同学年龄的男学生姓名和年龄。 8)检索姓名以Y打头的所有教师所教授课程的课程号和课程名。 9)在表SC中,当某个成绩低于全部课程的平均成绩时,提高5%。 10)在SC中删除尚无成绩的选课元组。

1)select c# from c where cname=’数据库原理及应用’ 2)select sname,sex from student where age>20 and sex=’女’ 3)select c#,grade from sc where s#=’s3’ 4)select c# from c where c# not in (select c# from s,sc where s.s#=sc.s# and sname=’WANG’) 5)select c#,count(*) from sc group by c# having count(*)>=15 order by 2 desc,1 asc 6)select c#,max(grade),min(grade) from sc,c where c.c#=sc.c# and teacher=’LIU’group by c.c# 7)select sname,age from s where age>(select avg(age) from s where sex=’女’) and sex=’男’ 8)select c#,cname from c where teacher like ‘Y%’ 9)update sc set grade=grade+grade*5% where grade<(select avg(grade) from sc) 10)delete from sc where grade is null