原题解2:
select cno, count(sno) as num
into G2
from sc
group by cno
having count(sno)>15
select cname,num
from course,G2
where o=o
order by 2 desc,1 asc
原题解3:
select cname,num
from course,(select cno, num=count(sno) from sc group by cno having count(sno)>15) a where o=o
order by 2 desc,1 asc
15)检索成绩为空值的学生姓名和课程名。
select sname, cname
from student ,sc,course
where student.sno=sc.sno and o=o and grade is null;
16)关系student中插入一个学生元组(02201101,“李平”,“CS”),AGE、SEX分别以默
认值插入。
insert
into student
values('02201101','李平','CS',default,default);
17)为“CS”系创建一个视图:CS_S(sno,sname,cname,grade)。
create view cs_s
as
select student.sno,sname,cname,grade
from student,sc,course
where student.sno=sc.sno
and sc.sno=o
and student.dep=’CS’
18)查询课程号为“1001”课程考试成绩排名为5-7名的学生的学号和成绩。
搜索“diyifanwen.net”或“第一范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,第一范文网,提供最新人文社科SQL作业参考答案(4)全文阅读和word下载服务。
相关推荐: