山东大学数据库实验8
亲测可用
1.
create table test8_01(Dname varchar(30),Avg_ds_score int,Avg_os_score int)
insert into test8_01 select dname,round(avg(score),0),0 from pub.student,pub.course,pub.student_course where pub.student.sid=pub.student_course.sid and pub.student_course.cid= pub.course.cid and dname is not null and pub.course.name='数据结构' group by dname
update test8_01 set Avg_os_score=(select avg(score) from pub.student,pub.course,pub.student_course where pub.student.sid=pub.student_course.sid and pub.student_course.cid= pub.course.cid and dname is not null and test8_01.dname=pub.student.dname and pub.course.name='操作系统' group by dname)
2.
select * from pub.student
create table test8_02(sid varchar(12),name varchar(10),dname varchar(30),ds_score int,os_score int)
insert into test8_02 select pub.student.sid,pub.student.name,dname,0,0 from pub.student where dname='计算机科学与技术学院' and sid in(select sid from pub.student_course where cid=(select cid from pub.course where name='数据结构') intersect(select sid from pub.student_course where cid=(select cid from pub.course where name='操作系统')))
update test8_02 set ds_score=(select score from pub.student_course where cid=(select cid from pub.course where name='数据结构') and test8_02.sid=pub.student_course.sid)
update test8_02 set os_score=(select score from pub.student_course where cid=(select cid from pub.course where name='操作系统') and test8_02.sid=pub.student_course.sid)
3.
create table test8_03(sid varchar (12),name varchar(10),dname varchar(30),ds_score int,os_score int)
insert into test8_03 select pub.student.sid,pub.student.name,dname,null,null from pub.student where dname='计算机科学与技术学院' and sid in(select sid from pub.student_course where cid=(select cid from pub.course where name='数据结构') union(select sid from pub.student_course where cid=(select cid from pub.course where name='操作系统')))
update test8_03 set ds_score=(select score from pub.student_course where cid=(select cid from pub.course where name='数据结构') and
test8_03.sid=pub.student_course.sid)
update test8_03 set os_score=(select score from pub.student_course where cid=(select cid from pub.course where name='操作系统') and
test8_03.sid=pub.student_course.sid)
4.
create table test8_04(sid varchar(12),name varchar(10),dname varchar(30),ds_score int,os_score int)
insert into test8_04 select pub.student.sid,pub.student.name,dname,null,null from pub.student where dname='计算机科学与技术学院'
update test8_04 set ds_score=(select score from pub.student_course where cid=(select cid from pub.course where name='数据结构') and
test8_04.sid=pub.student_course.sid)
update test8_04 set os_score=(select score from pub.student_course where cid=(select cid
from pub.course where name='操作系统') and
test8_04.sid=pub.student_course.sid)
update dbtest set test=8
select * from dbscore where 实验号=8
你可能喜欢
- 数据库查询
- 数据结构试题及答案
- 数据库实验
- 数据库答案
- 山东大学数据库
- 安徽大学数据库
- 北京工业大学 数据库
- 中南大学数据库
- 数据库查询实验题1页
- 基于NET实现分布式数据库查询论文5页
- 多条件数据库查询的优化方法4页
- 简单数据库查询语句20页
- 一种用Excel实现基于Delphi数据库查询结果输出的方法2页
- sql在不同数据库查询前几条数据1页
- 北京理工大学数据结构十年期末试题及答案39页
- 数据结构试题及答案40页
- 全国2011年10月自学考试数据结构导论试题及答案3页
- 计算机应用基础数据结构部分试题及答案12页
- 数据结构试题及答案6页
- 数据结构模拟试题及答案39页
- 00山东科技大学数据库课后习题答案+习题49页
- 第5章 数据库对象的操作 - 山东师范大学50页
- 山东大学数据库15事务46页
- 山东大学数据库07数据库设计180页
- 山东大学数据库05其它关系语言21页
- 山东大学数据库04高级sql88页
- 安徽工业大学数据库复习2页
- 安徽工业大学数据库试题2011-201213页
- 安徽工业大学数据库试题2010-201113页
- 安徽工业大学工商学院数据库概念1页
- 安徽工业大学周兵数据库实验报告28页
- 安徽工业大学--数据库课程设计--含代码17页


