下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、学籍管理系统数据库中的表。表student_course,student,course,tearch_course和teacher。各个表的具体结构如下:表1 student表(学生信息表)字段名称类 型宽 度允许空值主 键说 明snochar8not null是学生学号snamechar8not null学生姓名sexchar2null学生性别nativechar20null籍贯birthdaysmalldate4null学生出生日期dnochar6null学生所在院系spnochar8null专业代码(外键)classnochar4null班级号entimesmalldate4null学生
2、入校时间homevarchar40null学生家庭住址telvarchar40null学生联系电话表2 course表(课程信息表)字段名称类 型宽 度允许空值主 键说 明cnochar10not null是课程编号spnochar8null专业代码(外键)cnamechar20not null课程名称ctnotinyint1null课程类型编号(外键)experimenttinyint1null实验时数lecturetinyint1null授课学时semestertinyint1null开课学期credittinyint1null课程学分表3 student_course表(学生选课成绩表)
3、字段名称类 型宽 度允许空值主 键说 明snochar8not null是学生学号tcidsmallint2not null是上课编号scoretinyint1null学生成绩表4 teacher表(教师信息表)字段名称类 型宽 度允许空值主 键说 明tnochar8not null是教师编号tnamechar8not null教师姓名sexchar2null教师性别birthdaysmalldate4null教师出生日期dnochar6null教师所在院系pnotinyint1null教师职务或职称编号homevarchar40null教师家庭住址zipcodechar6null邮政编码te
4、lvarchar40null联系电话emailvarchar40null电子邮件表5 teacher_course表(教师上课课表)字段名称类 型宽 度允许空值主 键说 明tcidsmallint2not null是上课编号tnochar8null教师编号(外键)spnochar8null专业代码(外键)classnochar4null班级号cnochar10not null课程编号(外键)semesterchar6null学期schoolyearchar10null学年classtimevarchar40null上课时间classroomvarchar40null上课地点weektimeti
5、nyint1null每周课时数1 简单查询操作对educ数据库实现以下查询:(1)求计算机系的学生学号和姓名;select sno,snamefrom studentwhere sdept=is(2)求选修c1 课程的学生学号和成绩,并要求对查询结果按成绩的降序排列,如果成绩相同则按学号的升序排列;select sno,scorefrom student_coursewhere cno=101order by score desc,sno(3)求选修课程c1 且成绩在8090 之间的学生学号和成绩,并将成绩乘以系数0.75 输出;select sno,score*0.75from studen
6、t_coursewhere cno=101 and (score=80)(4)求计算机系和数学系的姓张的学生的信息;select *from student where (sdept=cs or sdept=ms )and sname like 张%(5)求缺少了成绩的学生的学号和课程号。select sno,cnofrom student_course where score is null(6)将成绩大于90分的学生成绩存入永久成绩表;将成绩小于90存入临时成绩表中。select score into prescorefrom student_course where score 90se
7、lect score into #posscorefrom student_course where score 90 and student_course.sno=student.sno(4)查询每一门课的间接先行课。select o,second.spnofrom course first, course secondwhere first.spno= o and second.spno is not null3子查询操作,在数据库educ中实现查询:(1)求选修了高等数学的学生学号和姓名;select sno,sname from studentwher
8、e sno in (select sno from student_coursewhere cno in ( select cnofrom coursewhere cname=高等数学)select student.sno,sname from student,course,student_coursewhere student.sno=student_course.sno and student_o=oand ame=高等数学(2)求c1 课程的成绩高于张三的学生学号和成绩;select sno,scorefrom student_coursewhere cno = 101 and score some(select scorefrom student_coursewhere cno =101 and sno in(select snofrom studentwhere sname=张楠)(3)求其他系中比计算机系某一学生年龄小的学生信息(即求其它系中年龄小于计算机系年龄最大者的学生);some(any)均可以select *from studentwhere sdept
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 《Proteus仿真平台单片机项目式教程》课件 项目1 双闪灯-2.Proteus仿真软件的使用及在线联调
- 2024年同意两地分居协议书范文范本
- 《计算机网络安全防护技术(第二版)》 课件 第5章 任务5.3 Dhcp攻击与Dhcp snooping防护
- 职业技术学院《报关与报检运作实务》课程标准
- 压缩天然气(CNG)加油站项目可行性研究报告
- 运动训练方法与技巧
- 《核能行业网络安全同行评估与成员支持活动实施导则》(征求意见稿)
- 生产经营单位安全培训试题附参考答案(精练)
- 全员安全培训试题答案打印
- 新入职员工安全培训试题及参考答案(A卷)
- MOOC 医学统计学-复旦大学 中国大学慕课答案
- 林夕歌词集完整版本
- 课桌椅人体工程学设计
- 2024年4月自考00402学前教育史试题及答案含评分标准
- 招标代理机构选取质量保障方案
- 牛黄解毒片对肿瘤生长的抑制作用研究
- 腾讯公司英文介绍
- 监控维修施工方案
- 心理睡眠科普知识讲座
- 办公设备投标方案(技术方案)
- 储能设备维保合同范本
评论
0/150
提交评论