计算机学院 数据库系统 课程实验报告
实验题目:报表统计 学号:
日期: 班级: 姓名:
Email:
实验目的:
oracle 管理平台下,进行 SQL 语句综合应用
实验软件和硬件环境:
软件:ob10、win7/8/10
实验原理和方法:
SQL 的数据定义语言用于创建具有特定模式的关系,并且提供多种用于查询数
据库的语言结构。
实验步骤:(不要求罗列完整源代码)
1. 查 询 各 院 系 ( 不 包 括 院 系 名 称 为 空 的 ) 的 数 据 结 构 平 均 成 绩
avg_ds_score、操作系统平均成绩 avg_os_score,平均成绩四舍五入到
个位,创建表 test8_01
create table test8_01(dname varchar(20), avg_ds_score int,
avg_os_score int)
create table t1 as
select dname,sid,cid,max(score) max_score
from pub.STUDENT natural join pub.STUDENT_COURSE
where dname is not null
group by dname,sid,cid
update test8_01
set Avg_ds_score =
(select round(avg(max_score),0)
from t1 natural join pub.COURSE
where name = '数据结构'
and test8_01.DNAME = dname
group by dname)
update test8_01
set Avg_os_score =
(select round(avg(max_score),0)