- 1、本文档共6页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
中南大学数据库技术试题(四)-答案
中南大学考试试卷20 --20 学年 下 学期 时间100分钟
数据库应用基础 课程 56 学时 3.5 学分 考试形式: 闭 卷
专业年级: 商学院级 总分100分,占总评成绩70%
一、、判断下列描述或命令是否正确,如果不正确,在不改变原来命令意义的基础上改正(共分)
在数据库的三级模式结构中,描述数据库中全体数据的全局逻辑结构和特征的是当关系的型改变时,用户程序也可以不变,这是数据的在数据库的三级模式结构中,描述数据库中全体数据的全局逻辑结构和特征的是当关系的型改变时,用户程序也可以不变,这是数据的 on name to student
判断结果:错误。
改正:create index ind_sname on student(name)
(5)查询出‘土家族’和‘苗族’学生的有关信息。
select no,name,sex,class from student where na=’ 土家族’ Union
Select no,name,age,class from student where na=’苗族’select no,name,sex,class from student where na=’ 土家族’ Union
Select no,name,sex,class from student where na=’苗族’’2010’课程最高分的学生学号及成绩。
select no,grade from sc where cno=’2010’ and grade=max(grade)
判断结果:错误。
改正:select no,grade from sc where cno=’2010’ and grade=(select max(grade) from sc where cno=’2010’)
(7)查询还没有录入成绩的学生学号及姓名。
select no,name from student,sc where grade=null
判断结果:错误。
改正:select sc.no,name from student,sc where student.no=sc.no and grade is null
(8)insert into sc select no, cno from student,c,sc where class=’1002’ and sc.no=student.no and name=’数据库技术’
判断结果:错误。
改正:insert into sc(no,cno,tno)
select distinct student.no, cno, tno from student,c,sc where sc.no=student.no and sc.cno=c.no and class=’1002’ and c.name=’ 数据库技术’’ and (tno=’1003’ or tno=’0102’)
说明:第8题原来本意是要求一个班的学生实现选修某一门课,不指定老师,但因为sc表中tno 不能为空,所以改时加一个统一的教师号。若写成以下,不扣分:
insert into sc(no,cno)
select distinct student.no,cno from student,c,sc where sc.no=student.no and sc.cno=c.no and class=’1002’ and c.name=’ 数据库技术’
三、写出下列命令的结果。(本题分)
(1) no name class cno grade
-----------------------------------------------------------
0108 周冰 1015 2015 NULL
0105 王刚 1015 2015 78
0110 张明 1002 2015 82
0102 李晓 1015 2015 85
(2)elect student.class,sc.cno,avg(grade),count(cno) from student,sc
where student.no=sc.no group by student.class,sc.cno having count(cno)=1
class cno 无列名 无列名
-----------------------------------------------
1002 2010 NULL 1
1015 2010 89 3
1002 2015 82 1
1015 2015 81 3
(3) Selec
文档评论(0)