数据库课程设计2_第1页
数据库课程设计2_第2页
数据库课程设计2_第3页
数据库课程设计2_第4页
数据库课程设计2_第5页
已阅读5页,还剩8页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、数据库课程设计(二)班级:计算机jt023班姓名:王英明学号:112142020304指导老师:邢玉萍一、 课程设计目的在理论和实验教学基础上进一步巩固已学基本理论及应用知识并加以综合提高学会将知识应用于实际的方法,提高分析和解决问题的能力,增强动手能力为毕业设计和以后工作打下必要基础二、 课程设计要求运用数据库基本理论与应用知识,在微机rdbms的环境上建立一个数据库应用系统。要求把现实世界的事物及事物之间的复杂关系抽象为信息世界的实体及实体之间联系的概念模型,再转换为机器世界的数据模型和数据文件,并对数据文件实施检索、更新等操作。1 可在以下内容中仅选一题2 用e-r图设计概念模型3 设计

2、关系模型4 分析关系模式各属于第几范式,阐明理由5 设计应用系统的系统结构图6 使用对象许可和命令许可设计安全性控制检查程序7 使用cheek和rule设计表的有效性规则及说明8 为每一库表设计插入、删除、修改触发器9 设计关系的外码约束10 完成内容指定的各项要求11 分析遇到的问题,总结并写出课程设计报告三、 课程设计题目题目2:设计一个大学教学数据库应用该系统涉及学生、教师、课程、分组、登记。数据见附表5-9。完成以下操作:(1) 定义各文件的结构(2) 编制输入子系统,完成数据的录入(3) 检索系名为“math”和“english”的课程表信息(4) 按字母顺序列出教师姓名和电话号码(

3、5) 检索电话号码不是以“257”打头的教师姓名和电话号码(6) 检索数学系所有成绩大于3的课程名、系名、学分(7) 检索没有选修任何课的学生姓名、学号(8) 检索没有选修课程“calculus iv”的学生学号(9) 检索至少选修教师“dr. lowe”所开全部课程的学生学号(10) 检索每门课学生登记的人数、相应的课程名、课程号、分组号(11) 检索选修两门以上课程的学生姓名(12) 检索只有男生选修的课程和学生名(13) 列出所有学生选修的课程名、学生名、授课教师名、该生成绩(14) 删去名为“joe adams”的所有记录(15) 把教师“scango”的编号改为“666”(16) 统

4、计教师“engle”教的英语课的学生平均分(17) 统计各门课程的选课人数(18) 统计学生来自省的省名(19) 输出如下报表:学生名课程名教师名成绩(20) 输出操作结果和程序清单附表5-9附表5:学生(students)学号(student)姓名(student-name)地址(address)邮政编码(zip)市(city)省(state)性别(sex)148susan powell534 east river dr19041haverfordpaf210bob dawson120 south jefferson02891newportrim298howard mansfield290

5、wynkoop drive22180viennavam348susan pugh534 east hampton dr06107hartfordcnf349joe adams473 emmerson street19702newarkdem354janet ladd441 10th street18073pennsburgpaf410bill jone120 south harrison92660newportcam473carol dean983 park avenue02169bostonmaf548allen thomas238 west ox road60624chicagoilm55

6、8val shipp238 westport road60556chicagoilf649john anderson473 emmory street10008new yorknym654janet yhomas441 6th street16510eriepaf附表6:教师(teachers)教师编号(teacher)姓名(teacher-name)电话号码(phone)工资(salary)303dr. horn257-304927540.00290dr. lowe257-239031450.00430dr .engle256-462138200.00180dr. cooke257-8088

7、29560.00560dr. olsen257-808631778.00784dr. scango257-304632098.00附表7:课程(courses)课程号(course)课程名(course-name)系名(department)学分(nurc-credits)450western civilizationhistory3730calculus ivmath4290english compositionenglish3480compiler writingcomputer science3附表8:分组(section)组号(section)教师编号(teacher)课程号(cour

8、se)学生数量(num-students)130345021290730614302903118048032560450227844802附表9:登记(enrolls)课程号(course)组号(section)学生学号(student)评分(grade)730114834502210373012101290129834802298373013482290134944801358448014102450147327301473348024730290154827301558373016494480164944501654445025481 e-r图属于于学习sectionsteachersst

9、udentsmnn1教授nnncourses对应1对应31对应2n111enrolls关系模型:学习(student,teacher)属于(teacher,section)教授(teacher,course)对应1(student,(course,section,student))对应2(course, (course,section,student))对应3(section,(course,section,student))改关系属于第一范式因为存在部分函数依赖四、 实验内容及其源程序4.检索系名为math和english的课程表信息select *from courseswhere cou

10、rses.department=math select *from courseswhere courses.department=english结果:course coursename department nurccredits730 calulus iv math 4course coursename department nurccredits290 english composition english 35.按字母顺序列出教师姓名和电话号码select teachername,phonefrom teacherswhere teachername like dr.%order by

11、 teachername asc结果:teachername phonedr.cooke 257-8088 dr.engle 256-4621 dr.horn 257-3049 dr.lowe 257-2390 dr.olsen 257-8086 dr.scango 257-3046 6.检索电话号码不是以257开头的教师姓名和电话号码select teachername,phonefrom teacherswhere teachers.phone not like 257-_结果:teachername phonedr.engle 256-4621 7.检索数学系所有成绩大于3的课程名,系名

12、,学分select coursename,department,nurccreditsfrom courseswhere department=math and nurccredits=3结果:coursename department nurccreditscalulus math 48.检索没有选修任何课的学生名,学号select studentname,enrolls.studentfrom students,enrollswhere students.student=enrolls.student and enrolls.course is null结果:studentname stu

13、dent9.检索没有选修课程calculus iv的学生学号select distinct studentfrom courses,enrollswhere courses.course=enrolls.course and courses.coursename!=calculus iv结果student148 210 298 348 349 358 410 473 548 558 649 654 10.检索至少选修教师dr.lowe所开全部课程的学生学号select distinct studentfrom enrolls,teachers,sectionswhere exists (sel

14、ect * from enrolls,teachers,sections where teachers.teacher=sections.teacher and sections.course=enrolls.course and teachers.teachername=dr.lowe group by student having count(distinct enrolls.course)=(select count(distinct enrolls.course) from enrolls,teachers,sections where teachers.teacher=section

15、s.teacher and sections.course=enrolls.course and teachers.teachername=dr.lowe)结果:student148 210 298 348 349 358 410 473 548 558 649 654 11检索每门课学生的登记人数,相应的课程名,课程号,分组号select courses.course,sum(numstudents) 人数,courses.coursenamefrom sections,courseswhere courses.course=sections.coursegroup by courses.c

16、oursename,courses.course结果:course 人数 coursename290 3english composition 450 4western civilization 480 5compiler writing 730 6calulus iv 12.检索选修两门以上课程的学生姓名select studentnamefrom students,enrollswhere students.student=enrolls.studentgroup by studentnamehaving count(*)=2结果:studentnameallen thomas bob d

17、awson carol dean howard mansfield john anderson13检索只有男生选修的课程和学生名 select coursename,studentnamefrom students,courses,enrollswhere students.student=enrolls.student and courses.course=enrolls.course and sex=m结果:studentname coursenamewestern civilization bob dawson western civilization allen thomas calu

18、lus iv bob dawson calulus iv john anderson english composition howard mansfield english composition allen thomas compiler writing howard mansfield compiler writing bill jone compiler writing john anderson 14检索所有学生选修的课程名,学生名,授课教师名,该生成绩select distinct coursename,studentname,teachername,gradefrom stude

19、nts,courses,enrolls,sections,teacherswhere courses.course=sections.course and sections.course=enrolls.course and students.student=enrolls.student and teachers.teacher=sections.teacher and students.student=enrolls.studentgroup by enrolls.student,courses.coursename,students.studentname,teachers.teache

20、rname,enrolls.grade结果:coursenamecalulus iv sdudentname teachername gradebob dawson dr.lowe 1calulus iv carol dean dr.lowe 3calulus iv john anderson dr.lowe 4calulus iv susan powell dr.lowe 3calulus iv susan pugh dr.lowe 2calulus iv val shipp dr.lowe 3compiler writing bill jone dr.cooke 2compiler wri

21、ting carol dean dr.cooke 0compiler writing howard mansfield dr.cooke 3compiler writing john anderson dr.cooke 4english composition allen thomas dr.engle 2english composition howard mansfield dr.engle 3western civilization allen thomas dr.horn 1western civilization allen thomas dr.olsen 1western civi

22、lization bob dawson dr.horn 3western civilization bob dawson dr.olsen 3western civilization carol dean dr.horn 2western civilization carol dean dr.olsen 2western civilization janet yhomas dr.horn 4western civilization janet yhomas dr.olsen 415.删去名为joe adams的所以记录delete from studentswhere studentname=

23、joe adamsdelete from enrollswhere enrolls.student= (select enrolls.student from students,enrolls where students.student=enrolls.student and studentname=joe adams)结果:存在于数据库中16把教师scango的编号改为666update teachersset teacher=666where teachername like %scango结果:存在于数据库中17统计教师engle教的英语课的学生平均分select avg(grade)

24、 平均分from courses,enrolls,teachers,sectionswhere courses.course=enrolls.course and teachers.teacher=sections.teacher and coursename=english composition and teachername like %engle结果:平均分318统计各门课程的选课人数select coursename,count(numstudents) 选课人数from courses,sectionswhere courses.course=sections.coursegrou

25、p by coursename结果:coursename 选课人数 calulus iv 1compiler writing 2english composition 1western civilization 219统计学生来自的省名select studentname,statefrom studentsgroup by studentname,students.state结果:studentname stateallen thomas il bill jone ca bob dawson r1 carol dean ma howard mansfield va janet ladd pa

26、 janet yhomas pa john anderson ny susan powell pa susan pugh cn val shipp il 20输出如下报表:学生名课程名教师名成绩select studentname 学生姓名,courses.coursename 课程名,teachername 教师姓名,grade 成绩from students,courses,teachers,enrolls,sectionswhere teachers.teacher=sections.teacher and sections.course=enrolls.course and students.student=enrolls.student and courses.course=enrolls.course结果:学生名 课程名 susan powe

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论