学生成绩管理---课程设计内容摘要:

re values(39。 10139。 ,39。 0239。 ,85) insert into score values(39。 10239。 ,39。 0239。 ,80) insert into score values(39。 10139。 ,39。 0339。 ,88) insert into score values(39。 10239。 ,39。 0239。 ,85) insert into score values(39。 10239。 ,39。 0339。 ,80) insert into score values(39。 10339。 ,39。 0139。 ,83) insert into score values(39。 10339。 ,39。 0239。 ,85) insert into score values(39。 10339。 ,39。 0339。 ,90) insert into score values(39。 10439。 ,39。 0139。 ,60) „„„„ 查看记录 Select * from score ( 3)、向教师表中添加数据 insert into course values(39。 0139。 ,39。 计算机 39。 ,39。 1139。 ) insert into course values(39。 0239。 ,39。 网络管理 39。 ,39。 1239。 ) insert into course values(39。 0339。 ,39。 专业英语 39。 ,39。 1339。 ) insert into course values(39。 0439。 ,39。 软件工程 39。 ,39。 1439。 ) „„„„ 查看记录 Select * from course ( 4)、向课程表中添加数据 insert into teacher values(39。 1139。 ,39。 无意 39。 ,39。 计算机系 39。 ,39。 男 39。 ,39。 19734539。 ,39。 教授 39。 ) insert into teacher values(39。 1239。 ,39。 生活 39。 ,39。 计算机系 39。 ,39。 女 39。 ,39。 197512139。 ,39。 副教授 39。 ) insert into teacher values(39。 1339。 ,39。 没有 39。 ,39。 管理系 39。 ,39。 女 39。 ,39。 19753339。 ,39。 副教授 39。 ) insert into teacher values(39。 1439。 ,39。 离开 39。 ,39。 英语系 39。 ,39。 男 39。 ,39。 19735539。 ,39。 教授 39。 ) „„„„ 查看记录 Select * from teacher 一些查询语句 ( 1)、查询成绩大于学号为 101 的学生的课程为 02 的成 绩的所有列。 select * from score where degree(select degree from score where sno=39。 10139。 and o=39。 0239。 ) ( 2)、查询课程号 01 大于课程号 02 的最大值、并以分数降序排序的成绩表中所有列 select * from score s where =39。 0139。 and =(select max(degree) from score y where =39。 0239。 ) order by degree desc go select max(degree) as 02max from score where o=39。 0239。 (3)、查询性别为男的学号,姓名,班级,课程号和成绩的学生 select , from student,score where = and ssex=39。 男 39。 (4)、查询成绩在 60 到 80 之间的所有列 select * from score where degree between 60 and 80 (5)、查询 score 表中至少有 5 名学生选修的并以 0 开头的课程的平均分 select avg(degree) as 平均分 ,o from score where o like 39。 0%39。 group by o having count(*)=5 创建自定义数据类型 创建一个 自定义数据类型 exec sp_addtype , 39。 varchar(20)39。 , 39。 null39。 修改 student 表中的 s 数据类型为 类型 alter table student alter column s 向表中添加字段 向 student 表添加 type,s,b 并且邮件地址有 check 约束 alter table student add type char(7) alter table student add s varchar(20) null constraint ck_sem check (s like 39。 %@%39。 ) alter table teacher add tel varchar(15) 创建视图 ( 1)、创建所有 11 班的学生信息的视图 create view student11 as select * from student where class=39。 1139。 查看视图中的记录 select * from student11 ( 2)、创建视图 course_degree,其中的内容是选修计算机课程的学生信息,包括( sno,sname,o,ame,degree),创建时加上 with check option create view course_degree(sno,sname,o,ame,degree) as select ,sname,ame,degree from course ,student, score where = and = and ame=39。 计算机 39。 with check option 查看视图中的记录 select * from course_degree ( 3)、创建一个视图,其中的内容是成绩表中每门课程的 create view average as select avg(degree) as 39。 平均分 39。 from score group by o 查看视图中的记录 select * from average ( 4)、创建视图其中的内容是所有男教师和男学生的 name,sex,birth creat。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。