大连理工大学软件学院 数据库 Intermediate SQL-2 上机答案
大连理工大学软件学院数据库IntermediateSQL-2上机答案

大连理工大学软件学院数据库IntermediateSQL-2上机答案大连理工大学软件学院数据库Intermediate SQL-2上机答案你的下载是我上传的动力,请不要吝啬一个财富值Intermediate SQL-2Using the university schema that you have write the following queries. In some cases youmight need to insert extra data to show the effect of a particular feature.Recommendation: With clause is strongly recommended for simplifying the query.1. Find the courses which have been offered for 2 years at least and have sections in spring,2010. For each course as such, information displayed should involve:* Identifier of course(i.e. the primary key for section)* Title of the course* Number of instructors who in charge of teaching the course in spring ,2010* Total salary all over the instructors who in charge of teaching the course inspring ,2010* Total credit hours performed per week( Note: 1 credit hour equals to 50 minutes).2. USE outer join to construct the following queryFind all information for student registration and course offered.The students who havenever registered for any courses and the courses has never been offered. For each record inthe result, information displayed should involve:* Identifier of student(i.e. the primary key for student)* Name of student* Identifier of section(i.e. the primary key for section)* Title of course.The result should be like the following3. USE scalar subquery to construct the following queryFor all students, grade information of each student is needed. Those students who havenever registered for any section should also be considered. For each student, informationdisplayed should involve:* Identifier of student(i.e. the primary key for student)* Name of student* Department name of student* Number of failure for the student to pass some section. (That is the number of grade ‘F’)* Total number of failure of passing sections for the students in the same department asthe current student.4. Find students who have registered for some but not all courses(PART COURSE, for short)taught by instructors of department '拳脚学院'. Furthermore, the registration of thesestudents for such courses (i.e. PART COURSE above) should have grade, even the grade is‘F’. Do this using the "not exists ... except ..." structure. Foreach student as such,information displayed should involve:* Identifier of student(i.e. the primary key for student)* Name of the student* Number of courses, taught by instructors of department '拳脚学院', registered by thestudent5. Use EXISTS or NOT EXISTS clause in WHERE clause to construct following query.Find those sections which have no instructor as the teacher. Moreover, these sectionsshould have never been registered by any student. For each section as such, informationdisplayed should involve:* Identifier of student(i.e. the primary key for student)* Name of the corresponding course.* Credits of the course--1with course_twoYear(course_id)as(select course_id from teaches wherecourse_id in(select course_idfrom teaches where year=2009)intersect(select course_idfrom teaches where year=2010 and semester='Spring')), number(course_id,ID,num)as (selectcourse_id,ID,COUNT(sec_id)from teacheswhere year=2010 and semester='Spring'group bycourse_id,ID),tot_time(course_id,times)as (selectcourse_id,SUM(credits*50)from course group bycourse_id)select course.course_id ,title ,num,SUM(salary)astot_sal,timesfrom course_twoYear ,course ,number,instructor,tot_time where course.course_id=course_twoYear.course_id and number.course_id=course.course_id andinstructor.ID=number.ID andcourse.course_id=tot_time.course_idgroup by course.course_id ,title ,num,times;--2with stu_take(course_id,name,sec_id,year,semester)as (select course_id,name,sec_id,year,semester from student left join takes on student.ID=takes.ID)select name,sec_id,year,semester,title from stu_take full join course on stu_take.course_id=course.course_id;--3selectstudent.ID,/doc/43a126d069dc5022aaea0 0be.html ,student.dept_name, (select COUNT(takes.grade)from takes wheretakes.ID=student.id and takes.grade='F'),(select COUNT(takes.ID)from student,takeswhere student.ID=takes.ID and takes.grade='F')from student;--4with T(student_name,total_course)as(select/doc/43a126d069dc5022aaea00be.html ,C OUNT(course.course_id)from student join takeson student.ID=takes.IDjoin course on takes.course_id=course.course_idwhere course.dept_name='拳脚学院'group by /doc/43a126d069dc5022aaea00be.html ) select ID,name,total_coursefrom student join T on /doc/43a126d069dc5022aaea00be.html =T.student_name where not exists((select student_name from T where T.total_course=(select COUNT(course_id)from course where course.dept_name='拳脚学院'))except(select student_name from T))--5select course.course_id,title,creditsfrom course Full outer join teaches on course.course_id = teaches.course_idFull outer join takes on course.course_id = takes.course_id Full outer join section on course.course_id = section.course_idwhere course.course_id not in((select course.course_idfrom teaches ,course ,takes ,section where teaches.course_id = section.course_id and takes.course_id = course.course_id and section.course_id = takes.course_id ) )。
大连理工大学《SQL数据库课程设计》大作业离线作业答案

学习中心:专业:计算机应用技术年级: 18年秋季学号:学生:题目:网上书店系统的设计与实现1.谈谈你对本课程学习过程中的心得体会与建议?在这次项目设计中,我们小组所选择的是设计一个图书管理系统,这对我们来说是一次尝试与创新的过程,也可以说是一个挑战的过程。
虽然学了数据库这么久了,但是我们还是缺少经验。
现在我们利用自己学到的知识设计并制作一个图书管理系统,这本身就是一个知识转化为生产力的过程,所以大家都很兴奋,都不同程度的投入了很高的热情与努力。
在具体的设计与实施中,我们看到并感受到了一个管理系统从无到有的过程,对具体的设计步骤、思路、方法、技巧都有了进一步的了解,并感受深刻。
这次课程设计加深了我们对数据库系统设计相关知识以及SQL SERVER相关功能的理解。
比如在建立基本的表、视图、索引、存储过程、触发器等,都比以前更加熟悉了,并在解决各种问题的过程中学到了很多新的知识。
在设计中我们基本能按照规范的方法和步骤进行,首先对现有的系统进行调查,并查阅有关资料,最后确定设计方案,然后设计并制作,实施过程中我们深刻的认识到认真执行管理系统软件标准的重要性,由于我们对管理系统软件相关的标准和规范不太了解,缺少行为操作准则,所以在设计中手法比较生硬,主与次也没能很好把握住,这些方面通过这次我们都要加强了解。
在这次课程设计中,我们被分配以小组为单位去完成图书管理系统的设计与制作,所以小组内的分工和相互协调很重要,大家可以在分工中扬长避短,个及所长,这样可以很好的提高大家的积极性,和合作意识,并有效的缩短开发时间,但我们在这方面做的还不够,缺乏人员管理与沟通,导致人力资源浪费,可以说是不足之处,且迫切的需要思考和改进,这一点必须指明。
这在以后的工作与学习中将会非常重要。
2.严格按照《SQL数据库课程设计要求》完成课程设计。
《SQL数据库课程设计》要求《SQL数据库课程设计》是大连理工大学网络教育学院计算机应用技术专业开展的一项实践教学环节,是理论联系实践的纽带和桥梁,是培养学生综合运用所学知识解决实际问题的有效手段。
大连理工大学智慧树知到“计算机科学与技术”《SQL数据库系统及应用》网课测试题答案卷4

大连理工大学智慧树知到“计算机科学与技术”《SQL数据库系统及应用》网课测试题答案(图片大小可自由调整)第1卷一.综合考核(共10题)1.触发器是一种特殊类型的存储过程,它通过事件触发而被自动执行。
()T.对F.错2.Microsoft SQL Server 2008只提供完整备份和完整差异备份这两种备份类型。
()T.对F.错3.model数据库主要用作SQL Server 2008实例上创建的所有数据库的模板。
()T.对F.错4.引用完整性的实现方法有:外键约束、核查约束、触发器、存储过程等。
()A.正确B.错误5.SQL Server中字符数据类型包括()。
A.int、money、charB.char、varchar、textC.datetime、binary、intD.char、varchar、int6.与创建数据库一样,把不直接使用SQL语句对表数据的操作称为界面操作表数据。
界面操作表数据主要在SQL Server Management Studio中进行。
()T.对F.错7.以下触发器是当对表11进行()操作时触发。
Create Trigger abc on 表11 Forinsert,update,delete As……。
A.只是修改B.只是插入C.只是删除D.修改、插入、删除8.SQL Server 2008支持的约束只有非空约束和主键约束。
()T.对F.错9.SQL Server 2008中采取了多种措施保证数据库的安全性和完整性,但故障仍不可避免,如用户的操作失误。
()T.对F.错10.假设表xsx的列x的类型是char,根据业务的发展需要改为整型(integer),应该使用下面的()语句。
A.ALTER COLUMN x integer FROM xsxB.ALTER TABLE xsx(x integer)C.ALTER TABLE xsx ALTER COLUMN x integerD.ALTER COLUMN xsx.x integer第1卷参考答案一.综合考核1.参考答案:T2.参考答案:F3.参考答案:T4.参考答案:A5.参考答案:B6.参考答案:T7.参考答案:D8.参考答案:F9.参考答案:T10.参考答案:C。
大连理工大学智慧树知到“计算机科学与技术”《SQL数据库系统及应用》网课测试题答案1

大连理工大学智慧树知到“计算机科学与技术”《SQL数据库系统及应用》网课测试题答案(图片大小可自由调整)第1卷一.综合考核(共15题)1.设关系数据库中一个表CJ的结构为CJ(sname,cname,grade),其中sname为学生姓名,cname为课程名,二者均为字符型;grade为成绩,数值型,取值范围0-100。
若要更正张三的化学成绩为85分,则可用()。
A.update CJ set grade=85 where sname='张三' and cname='化学'B.update set grade='85' where sname='张三' and cname='化学'C.update grade=85 where sname='张三' and cname='化学'D.create CJ grade=85 where sname='张三' and cname='化学'2.在SQL语句中,删除表M的命令是()。
A.DROP TABLE MB.DELETE_FOR TABLE MC.ERASE_FOR TABLE MD.DELETES DBF M3.DELETE FROM SSS WHERE 年龄60语句的功能是()。
A.从SSS表删除年龄大于60岁的记录B.在SSS表中创建一条年龄60的记录C.删除SSS表中所有列D.删除SSS表的年龄列4.以下触发器是当对表22进行()操作时触发。
Create Trigger abc on 表22 For delete As ......。
A.只是修改B.只是插入C.只是删除D.修改、插入、删除5.索引是在基本表的列上建立的一种数据库对象,它能够加快数据的()速度。
A.插入B.修改C.删除D.查询6.触发器是一种特殊类型的存储过程,它通过事件触发而被自动执行。
2022年大连理工大学软件工程专业《数据库原理》科目期末试卷A(有答案)

2022年大连理工大学软件工程专业《数据库原理》科目期末试卷A(有答案)一、填空题1、在关系数据库的规范化理论中,在执行“分解”时,必须遵守规范化原则:保持原有的依赖关系和______。
2、数据的安全性是指____________。
3、如图所示的关系R的候选码为;R中的函数依赖有;R属于范式。
一个关系R4、采用关系模型的逻辑结构设计的任务是将E-R图转换成一组______,并进行______处理。
5、数据库内的数据是______的,只要有业务发生,数据就会更新,而数据仓库则是______的历史数据,只能定期添加和刷新。
6、设某数据库中有商品表(商品号,商品名,商品类别,价格)。
现要创建一个视图,该视图包含全部商品类别及每类商品的平均价格。
请补全如下语句: CREATE VIEW V1(商品类别,平均价格)AS SELECT商品类别,_____FROM商品表GROUP BY商品类别;7、若事务T对数据对象A加了S锁,则其他事务只能对数据A再加______,不能加______,直到事务T释放A上的锁。
8、关系系统的查询优化既是关系数据库管理系统实现的关键技术,又是关系系统的优点。
因为,用户只要提出______,不必指出 ______。
9、____________、____________、____________和是计算机系统中的三类安全性。
10、从外部视图到子模式的数据结构的转换是由______________实现;模式与子模式之间的映象是由______________实现;存储模式与数据物理组织之间的映象是由______________实现。
二、判断题11、在数据表中,空值表示不确定。
()12、一个关系中不可能出现两个完全相同的元组是由实体完整性规则确定的。
()13、在SQL中,ALTERTABLE语句中MODIFY用于修改字段的类型和长度等,ADD用于添加新的字段。
()14、可以用UNION将两个查询结果合并为一个查询结果。
大连东软信息学院数据库(数据库选择题题库)

答案:C
分数:1
题型:选择题
难度:1
32. SQL 的 SELECT 语句中,“HAVING 条件表达式”用来筛选满足条件的(D)
()行 (B)列 (C)关系 (D)分组
答案:D
分数:1
题型:选择题
难度:1
33. SQL语言中,SELECT语句的执行结果是()
答案:B
分数:1
题型:选择题
难度:1
12.数据库的( )是指数据的正确性和相容性 ( )
(A)并发控制 (B)完整性 (C)安全性 (D)共享性
答案:B
分数:1
题型:选择题
难度:1
13.按照所使用的数据模型来分,数据库可分为哪三种模型
( )
(A)层次、关系和网状(B)网状、环状和链状
(C)大型、中型和小型(D)独享、共享和分时
答案:A
分数:1
题型:选择题
难度:1
14. char(10)与varchar(10)存储“abc”实际占用的字节数()
(A)3,3 (B)10,3 (C)3,10 (D)10,10
答案:B
分数:1
题型:选择题
难度:1
15. 有两个关系D、S,已经存有如下数据
D(院系表) S(学生表)
院系号
院系名
系主任
答案:B
分数:1
题型:选择题
难度:1
22. 以下不是SQL语句中的聚合函数的是: ( )
(A)SUM (B)AVG (C)COUNT (D)DISTINCT
答案:D
分数:1
题型:选择题
难度:1
23.若用如下的SQL语句创建了一个表SC: CREATE TABLE SC (S# CHAR(6) NOT NULL,C# CHAR(3) NOT NULL,SCORE INTEGER,NOTE CHAR(20));向SC表插入如下行时,( )行可以被插入 。()
大连理工大学20年秋季学期《SQL数据库系统及应用》在线作业2附参考答案

大连理工大学20年秋季学期《SQL数据库系统及应用》
在线作业2附参考答案
试卷总分:100 得分:100
一、单选题 (共 10 道试题,共 50 分)
1.在SQL的select语句中,如果要过滤结果中的重复行,可以在字段列表前面加上( )。
A.group
B.order
C.top
D.distinct
答案:D
2.在select语句中如果要对得到的结果中某个字段按降序处理,则使用( )参数。
A.asc
B.desc
C.between
D.and
答案:B
更多加微boge30619
3.查询学校员工工资信息时,结果按工资降序排列,正确的
是( )。
A.ORDER BY 工资
B.ORDER BY 工资 desc
C.ORDER BY 工资 asc
D.ORDER BY 工资 and
答案:B
4.当使用SQL语句进行分组检索时,为了按照一定的条件对分组后的数据进行筛选,应当( )。
A.在join后面使用between to子句
B.在group by后面使用having子句
C.在where后面使用order by子句
D.在join后面使用order by子句
答案:B
5.在SQL查询语句中,HAVING子句的作用是( )。
A.指出排序的范围
B.指出查询结果的最大值
C.指出分组查询的条件
D.指出创建数据表的字段
答案:C。
大连理工大学《软件工程》大作业离线作业答案

网络教育学院《软件工程》课程大作业题目:图书管理系统姓名:陈乐报名编号:学习中心:邢台技师学院层次:专升本专业:计算机科学与技术第一大题:谈谈你对本课程学习过程中的心得体会。
通过此次课程设计,使我更加扎实的掌握了有关软件工程方面的知识,在设计过程中虽然遇到了一些问题,但经过老师的指导,我们一一克服了困难完成了设计,在此感谢大连理工的辅导老师的辛勤指导,我也将会更加努力学习,掌握更多知识。
第二大题:完成下面一项课程设计。
2019秋《软件工程》课程大作业题目三:图书管理系统总则:不限制编程语言,可以选用VB/C#等,不限数据库,可选用SQL/MYSQL/ACCESS等设计一个图书管理系统。
(具体工具平台及语言可以自己根据自己的习惯选用,不必完全按照上述技术要求)要求:(1)撰写一份word文档,里面包括(需求分析规格书、详细设计说明书、测试报告书)章节。
(2)需求分析规格书,包含功能需求分析、数据需求分析。
功能需求分析介绍该系统具体包含何种功能。
(3)详细设计说明书包含数据表,核心程序,模块相关截图。
数据表为数据库所建立的数据表,至少包含用户信息表、图书信息表表等。
核心程序需列出系统的核心程序。
(4)测试报告书要求简单介绍测试的方法与测试的示例,举出一组示例即可。
(5)整个word文件名为 [姓名奥鹏卡号学习中心](如戴卫东101410013979浙江台州奥鹏学习中心[1]VIP )需求分析2.1 需求分析本系统是基于JSP的网上图书管理系统。
购书者在注册成为本网站的用户后,就可以浏览网站信息并且购买图书。
书店负责人对数据库等进行操作,及时更新网站信息。
2.2 数据分析(一)用户信息用户是指在本网站注册成功的购书者。
成为本网站的用户后才可以对本网站进行更多的操作。
包括,网上购书、填写订单、订单查询、留言等。
(二)管理员信息管理员负责对网站后台进行管理,包括数据库表的维护和对用户、订单、公告、留言等信息的管理。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
大连理工大学软件学院数据库Intermediate SQL-2上机答案你的下载是我上传的动力,请不要吝啬一个财富值Intermediate SQL-2Using the university schema that you have write the following queries. In some cases youmight need to insert extra data to show the effect of a particular feature.Recommendation: With clause is strongly recommended for simplifying the query.1. Find the courses which have been offered for 2 years at least and have sections in spring,2010. For each course as such, information displayed should involve:* Identifier of course(i.e. the primary key for section)* Title of the course* Number of instructors who in charge of teaching the course in spring ,2010* Total salary all over the instructors who in charge of teaching the course inspring ,2010* Total credit hours performed per week( Note: 1 credit hour equals to 50 minutes).2. USE outer join to construct the following queryFind all information for student registration and course offered.The students who havenever registered for any courses and the courses has never been offered. For each record inthe result, information displayed should involve:* Identifier of student(i.e. the primary key for student)* Name of student* Identifier of section(i.e. the primary key for section)* Title of course.The result should be like the following3. USE scalar subquery to construct the following queryFor all students, grade information of each student is needed. Those students who havenever registered for any section should also be considered. For each student, informationdisplayed should involve:* Identifier of student(i.e. the primary key for student)* Name of student* Department name of student* Number of failure for the student to pass some section. (That is the number of grade ‘F’)* Total number of failure of passing sections for the students in the same department asthe current student.4. Find students who have registered for some but not all courses(PART COURSE, for short)taught by instructors of department '拳脚学院'. Furthermore, the registration of thesestudents for such courses (i.e. PART COURSE above) should have grade, even the grade is‘F’. Do this using the "not exists ... except ..." structure. For each student as such,information displayed should involve:* Identifier of student(i.e. the primary key for student)* Name of the student* Number of courses, taught by instructors of department '拳脚学院', registered by thestudent5. Use EXISTS or NOT EXISTS clause in WHERE clause to construct following query.Find those sections which have no instructor as the teacher. Moreover, these sectionsshould have never been registered by any student. For each section as such, informationdisplayed should involve:* Identifier of student(i.e. the primary key for student)* Name of the corresponding course.* Credits of the course--1with course_twoYear(course_id)as(select course_id from teaches wherecourse_id in(select course_idfrom teaches where year=2009)intersect(select course_idfrom teaches where year=2010 and semester='Spring')), number(course_id,ID,num)as (selectcourse_id,ID,COUNT(sec_id)from teacheswhere year=2010 and semester='Spring'group bycourse_id,ID),tot_time(course_id,times)as (selectcourse_id,SUM(credits*50)from course group bycourse_id)select course.course_id ,title ,num,SUM(salary)astot_sal,timesfrom course_twoYear ,course ,number,instructor,tot_time where course.course_id=course_twoYear.course_id and number.course_id=course.course_id andinstructor.ID=number.ID andcourse.course_id=tot_time.course_idgroup by course.course_id ,title ,num,times;--2with stu_take(course_id,name,sec_id,year,semester)as (select course_id,name,sec_id,year,semester from student left join takes on student.ID=takes.ID)select name,sec_id,year,semester,title from stu_take full join course on stu_take.course_id=course.course_id;--3select student.ID,,student.dept_name, (select COUNT(takes.grade)from takes wheretakes.ID=student.id and takes.grade='F'),(select COUNT(takes.ID)from student,takeswhere student.ID=takes.ID and takes.grade='F')from student;--4with T(student_name,total_course)as(select ,COUNT(course.course_id)from student join takeson student.ID=takes.IDjoin course on takes.course_id=course.course_idwhere course.dept_name='拳脚学院'group by )select ID,name,total_coursefrom student join T on =T.student_name where not exists((select student_name from T where T.total_course=(select COUNT(course_id)from course where course.dept_name='拳脚学院'))except(select student_name from T))--5select course.course_id,title,creditsfrom course Full outer join teaches on course.course_id = teaches.course_idFull outer join takes on course.course_id = takes.course_idFull outer join section on course.course_id = section.course_idwhere course.course_id not in((select course.course_idfrom teaches ,course ,takes ,section where teaches.course_id = section.course_id and takes.course_id = course.course_idand section.course_id = takes.course_id ) )。