ImageVerifierCode 换一换
格式:DOCX , 页数:17 ,大小:458.02KB ,
资源ID:1259211      下载积分:15 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/1259211.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(北邮数据库实验报告(4).docx)为本站会员(b****2)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

北邮数据库实验报告(4).docx

1、数据库实验报告(四)姓名: 学号: 班级: 1. 简单查询:(1) 查询“数据库开发技术”课程的学分;SQL语句:select creditfrom coursewhere course_name=SQL Server数据库开发技术;或者模糊查询:select creditfrom coursewhere course_name like %数据库开发技术;执行结果:(2) 查询选修了课程编号为“dep04_s004”的学生的学号和成绩,并将成绩按降序输出;SQL语句:select student_id,gradefrom student_coursewhere course_id=dep04

2、_s003order by grade desc;执行结果:(3) 查询学号为“g9940205”的学生选修的课程编号和成绩;SQL语句:select course_id,gradefrom student_coursewhere student_id=g9940205;执行结果:(4) 查询选修了课程编号为“dep04_s001”且成绩高于85分的学生的学号和成绩。SQL语句:select student_id,gradefrom student_coursewhere course_id=dep04_s001 and grade85;执行结果:2. 在多表连接的查询实验中,用Transac

3、t SQL语句完成以下查询操作:(1)查询选修了课程编号为“dep04_s002”且成绩高于85分的学生的学号、姓名和成绩;SQL语句:select student.student_id,student_name,gradefrom student,student_coursewhere student.student_id=student_course.student_id and student_course.course_id=dep04_s002 and student_course.grade85;执行结果:(2)查询所有学生的学号、姓名、选修的课程名称和成绩;SQL语句:selec

4、t student.student_id,student_name,course_name,gradefrom student,course,student_coursewhere student.student_id=student_course.student_id and student_course.course_id=course.course_id;执行结果:(3)查询林红同学选修的课程名称、学分和成绩。(考试成绩60有学分,否则无学分。)SQL语句:select course_name,student_course.credit,gradefrom student,student

5、_course,coursewhere student_name=林红 and student.student_id=student_course.student_idand student_course.course_id=course.course_id;3. 在复杂查询实验中,用Transact SQL语句完成以下查询操作:(1)查询至少选修了三门课程的学生的学号和姓名;SQL语句:select student.student_id,student_namefrom student,student_coursewhere student.student_id=student_course

6、.student_id group by student.student_id,student_name having count(student_course.course_id)=3;执行结果:(2)查询选修课程号为“dep04_b001”的学生的平均成绩;SQL语句:select avg(grade)from student_coursewhere course_id=dep04_b001;执行结果:(3)查询所有学生的学号和他选修课程的最高成绩,要求他的选修课程中没有成绩为空的。SQL语句:select student_id,max(grade)from student_coursew

7、here exists(select grade from student_course)group by student_id;执行结果:(4) 查询严为老师2001/2002学年教的软件开发技术课程的最高成绩及此学生的学号、姓名、班级。SQL语句:select student.student_id,student_name,student.class_id,gradefrom teacher_course_class,teacher,course,student,student_coursewhere teacher_course_class.teacher_id = teacher.te

8、acher_id and teacher.teacher_name = 严为 and teacher_course_class.course_id = course.course_id and course.course_name = 软件开发技术 and teacher_course_class.course_id = student_course.course_id and student_course.student_id = student.student_id and teacher_course_class.school_year = 2001/2002 and student_c

9、ourse.grade=all(select grade from student_course,course where student_course.course_id = course.course_id and course.course_name = 软件开发技术);执行结果:(5) 查询数据库开发技术课程用过的教材名称,作者和出版社。SQL语句:select book_name,author,publish_companyfrom book,coursewhere course.book_id=book.book_id and course_name=SQL SERVER数据库开发

10、技术;执行结果:(6) 查询计算机科学系讲授过数据库开发技术的老师姓名和职称。SQL语句:select teacher_name,professionfrom teacher,course,teacher_course_class,departmentwhere teacher.teacher_id = teacher_course_class.teacher_id and course.course_id = teacher_course_class.course_id and department.department_id = teacher.department_id and depa

11、rtment.department_name = 计算机科学 and course.course_name = SQL Server数据库开发技术;执行结果:4. 在嵌套查询实验中,用Transact SQL语句完成以下查询操作,要求写嵌套查询语句:(1)查询选修了软件开发技术的学生的学号和姓名;SQL语句:select student_id,student_namefrom studentwhere student_id in (select student_id from student_course where course_id in (select course_id from co

12、urse where course_name = 软件开发技术);执行结果:(2)查询没有选修软件开发技术的学生的学号和姓名;SQL语句:select student_id,student_namefrom studentwhere not exists(select student_id from student_course where course_id in (select course_id from course where course_name = 软件开发技术);执行结果:(3)查询至少选修了学号为“g9940201”的学生所选修的所有课程的学生的学号和姓名。SQL语句:se

13、lect student_id,student_namefrom studentwhere not exists(select * from student_course student_course1 where student_course1.student_id = g9940201 and not exists (select * from student_course student_course2 where student.student_id=student_course2.student_id and student_course2.course_id = student_course1.course_id);执行结果:5. 建立如下视图:学生选修课程信息视图,包括以下内容:对(1)(2)内容用企业管理器和SQL语句方式分别完成。1) 学生学号、姓名、所在系、授课老师姓名、课程名称、课程教材名称、出版社、学分、选课成绩SQL语句:Create view view1(student_id,student_name,de

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1