版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、-现在有了教育管理系统。具体的关系模型如下:Student (no,name,sex,birthday,class)Teacher (no,name,sex,birthday,prof,depart)Course (cno,cname,tno)Score (no,cno,degree)牙齿表中的数据如下:Course表格:Score表格:Student表格:Teacher表格:按照上面的说明完成以下问题:(注:为了还原数据,请保存脚本,尤其是DDL和DML。)DDL1.为上面的表创建表语句。指令:create table Student(no nvarchar(5)、Name nvarchar
2、(5)、Sex nvarchar(1)、Birthday datetime、Class nvarchar(5),以获取详细信息DML2.提供相应的INSERT语句以完成问题中提供的数据插入。命令:单一表格祖怀3.按class降序输出student中的所有记录(student表中的所有属性)命令:select * from student order by class desc4.列出教师所在的单元depart(不重复)。命令:select distinct depart from teacher5.列出student表中所有记录的name、sex和class列命令:selectname、sex
3、、classfrom student6.student输出不是国王的同学的名字。命令:select name from student where name not like王%7.输出成绩为85、86或88或60-80之间的记录(no、cno、degree)命令:select * from score where degree=85 or degree=86 or degree=88 or degree between 60 and 808.出口班为95001或性别为“女人”的学生(student表中的所有属性)命令:select * from student where class=950
4、01 or sex=女人9.按cno升序、degree降序输出score中的所有记录。(score表格所有属性)命令:select * from score order by cno,degree desc10.出口男学生人数和牙齿男学生分布在多少班命令:selectcount (*),count(distinct class)from student where sex=man11.列出分数超过85分的课程编号。命令:select distinct cno from score where degree 8512.出口95001半的学生数量命令:选择计数(*) from student wh
5、ere class=9500113.输出“3-105”过程的平均分数命令:选择avg(degree)from score where cno=3-10514.student输出最大和最小birthday日期值命令:selectmax (birthday),min (birthday) from student15.95001和95004班全体学生的所有个人信息(选课除外)。(student表格所有属性)命令:select * from student where class=95001 or class=95004聚合查询16.至少5名学生选择并输出以3开头的课程的课程编号、课程平均分数、课程
6、最高分数、课程最低分数。命令:选择cno、avg (degree)、max (degree)、min (degree)来自ScoreWhere cno like 3%群组郑智薰cnoHaving COUNT(no)517.出口选择科目最低分在70分以上,最高分在90分以下的学生学号和学生姓名命令:select student.no,student . name from score inner join student on student . no=score . no group by student . no18.显示课程选择科目数超过5名的教师的名字命令:select name fro
7、m score inner join course on score . cn o=course . cn o inner join teacher on teacher . no=course . tno go19.输出“95001”班中选定课程的课程编号和平均值命令:select cno,avg(degree)from student inner join score on student . no=score . no where student . class=95020.输出至少有两个男生的班级号码。命令:select class from student inner join sc
8、ore on student . no=score . no where sex=manual group by class having count(distinct sex多表格祖怀21.列出与108号同学同年出生的所有学生的学号、名字和生日命令:select no,name,birthday from student where year(birthday)=(select year(birthday)from student where no22.列出成绩超过85分的课程名称命令:select cname from course inner join score on course .
9、 cn o=score . cn o group by cname having max(degree)8523.列出“计算机系”教师教的课程成绩单(课程编号、课程名称、学生名称、成绩)。命令:o,cname,,Degree from student inner join score on student . no=score . no inner join course on24.所有可能的“计算机系”和“电子工程系”都要列出不同职称的教师配对信息,并输出每个教师的名字(name)和(职称)命令:select 、ex1.pr
10、of、、f from teacher ex1、teacher ex2 where ex1 . depart=ex2 . prof25.徐璐列出其他班级中但具有相同生日的所有学生,并要求输出每个学生的学号和名字。(提示:使用datediff函数,您可以参阅http:/hcmfys . /blog/58844。)命令:Select ex1.no、、ex2.no、ex2 . name from student ex1 inner join student ex2 on ex1 . birthday=ex2=ex2 . classSe
11、lectex1.no,,ex2.no,开始student ex1,student ex2Where ex1.class!=ex2.classAnd datediff (day,ex1.birthday,ex2.birthday)=026.显示“张三”教师任课的学生名、课程名、成绩命令:select ,cname,degree from student inner join score on student . no=score . no inner join course on score27.列出讲课已经选好的老师的名字和学科命令:se
12、lect distinct ,depart from score inner join course on score . cn o=course . cn o inner join teacher on course28.输出所有学生的name,no,degree。如果Degree为空,则不输出;如果为空,则输出。命令:select ,student.no,degree from student inner join score on student . no=score . noSelect ,student.no,d
13、egree from student left join score on student . no=score . no29.列出所有在职教师的name和depart。(从课程选择和讲座两个茄子的角度考虑)命令:(选修课)S,depart来自scoreleft join course on score . cn o=course . cn oleft join teacher on course . tno=teacher . no(林科)Select distinct ,depart from teacher inn
14、er join course on teacher . no=course . tno30.出口男教师选修的课程名称。命令:select cname from teacher inner join course on teacher . no=course . tno where teacher . sex=男人31.和“李军”同姓的所有同学出来的name。命令:select name from student where sex=(select sex from student where name=Li jun)32.选择“数据结构”课程,导出完成的男生的成绩。命令:select degr
15、ee from student inner join score on student . no=score . no where sex=man33.列出了选修科目编号为“3-105”的课程,并选择了比“3-111”课程最高分数高的cno、no、degree。命令:select cno,student.no,degree from student inner join score on student . no=score . no where cno=3-105 aa子查询34.输出分数中成绩最高的学号和课程号命令:select no,cno from score where degree=(select max(degree)from score)35.出口3-105课程。其成绩是109号学生在牙齿过程中取得的成绩以上的所有学生的学号、名字命令:select student.no,Name from student inner join score on
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 酒店前台服务人员礼仪与问题解决技巧提升
- 别墅花园景观与装饰规划
- 元宇宙会展搭建服务规范
- 植物健康管理与植保技术探讨
- 工业管道安全操作培训教材
- 项目成本控制与财务执行流程优化探讨
- 传统中医养生的智慧与技巧
- 延伸护理服务的用药管理
- 计算机二级考试备考攻略与实战技巧
- 网络安全技术及防范措施探讨
- 建设施工分包安全管理培训讲义图文并茂
- C语言试讲稿课件
- (完整版)英语仁爱版九年级英语下册全册教案
- 三角形的认识(强震球)
- JJG 602-2014低频信号发生器
- GA/T 832-2014道路交通安全违法行为图像取证技术规范
- GA 1800.6-2021电力系统治安反恐防范要求第6部分:核能发电企业
- 教学课件-氢氧化钠溶液的配制与标定
- 人教版政治七年级下册全套课件
- 《水资源》-完整版课件
- 一级半压气机优化教程
评论
0/150
提交评论