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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

华南农业大学数据库系统概念实验一报告三.docx

1、华南农业大学数据库系统概念实验一报告三数据库系统实验报告三学号姓名实验时间2014-11-26实验名称数据查询实验学时4准备材料1. SQL Plus命令手册2. Oracle数据字典扩展实验1. 利用企业管理器的图形界面构造查询语句,并察看查询结果2. 利用企业管理器完成视图、索引的创建与使用。3. 利用DBMS进行对第三章习题所设计SQL语句的检查 (此部分内容不要求在实验室完成,不用写入实验报告。)实验环境Oracle 9i(及以上版本)服务器SQL Plus/ SQL Plus work sheet客户端实验目的1掌握使用SQL语句进行数据查询的方法2. 掌握视图的创建与使用方法3.

2、观察索引的使用效果实验内容及步骤1. 使用University数据库的数据库结构和数据(smallRelations即可),完成下列查询:(1) Find the names of courses in Computer science department which have 3 creditsSELECT titleFROM courseWHERE dept_name = Comp. Sci. AND credits = 3(2) For the student with ID 12345 (or any other value), show all course_id and titl

3、e of all courses registered for by the student. SELECT course_id,titleFROM takes NATURAL JOIN courseWHERE id = 123454. As above, but show the total number of credits for such courses (taken by that student). Dont display the tot_creds value from the student table, you should use SQL aggregation on c

4、ourses taken by the student. SELECT id,SUM(credits)FROM takes NATURAL JOIN student NATURAL JOIN courseWHERE id = 12345GROUP BY id;(3) As above, but display the total credits for each of the students, along with the ID of the student; dont bother about the name of the student. (Dont bother about stud

5、ents who have not registered for any course, they can be omitted) SELECT id,SUM(credits)FROM takes NATURAL JOIN student NATURAL JOIN courseGROUP BY id(4) Find the names of all students who have taken any Comp. Sci. course ever (there should be no duplicate names) SELECT DISTINCT id,NAMEFROM takes NA

6、TURAL JOIN studentWHERE course_id IN (SELECT course_id FROM course WHERE dept_name=Comp. Sci.)(5) Display the IDs of all instructors who have never taught a course (Notesad1) Oracle uses the keyword minus in place of except; (2) interpret taught as taught or is scheduled to teach)SELECT idFROM instr

7、uctorWHERE id NOT IN (SELECT DISTINCT id FROM teaches ) (6) As above, but display the names of the instructors also, not just the IDs.SELECT id,NAMEFROM instructorWHERE id NOT IN (SELECT DISTINCT id FROM teaches )(7) Find the maximum and minimum enrollment across all sections, considering only secti

8、ons that had some enrollment, dont worry about those that had no students taking that sectionSELECT max(enrollment),min(enrollment)from(SELECT sec_id,semester,year,COUNT(DISTINCT id) as enrollmentFROM takesGROUP BY sec_id,semester,YEAR); (8) As in in Q1, but now also include sections with no student

9、s taking them; the enrollment for such sections should be treated as 0. Do this in two different ways (and create require data for testing) 1). Using a scalar subquery 2). Using aggregation on a left outer join (use the SQL natural left outer join syntax)SELECT DISTINCT sec_id,semester,YEAR,IFNULL(c

10、ount,0)FROM section LEFT OUTER JOIN(SELECT sec_id,semester,YEAR,COUNT(DISTINCT id,sec_id,semester,YEAR) AS countFROM takesGROUP BY sec_id,semester,YEAR) AS T USING (sec_id,semester,YEAR)(9) Find all courses whose identifier starts with the string CS-1 SELECT *FROM courseWHERE course_id LIKE CS-1%(10

11、) Find instructors who have taught all the above courses 1). Using the not exists . except . structure 2). Using matching of counts which we covered in class (dont forget the distinct clause!) select distinct ID,name from teaches natural join instructor where not exists (select course_id from course

12、)except (select course_id from course where course_id like CS-1%);2. The university rules allow an F grade to be overridden by any pass grade (A, B, C, D). Now, create a view that lists information about all fail grades that have not been overridden (the view should contain all attributes from the t

13、akes relation).CREATE VIEW F AS SELECT * FROM takes WHERE grade = F3. Find all students who have 2 or more non-overridden F grades as per the takes relation, and list them along with the Fselect name,Fas final_gradefrom F natural join studentgroup by namehaving count(grade)=2;选择数量=1时有一个结果出现问题解决方案(列出遇到的问题及其解决方法)精品文档考试教学资料施工组织设计方案

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

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