SQL作业 急求高手教我做啊 !!!!!!!!!!!!!

[复制链接]
查看11 | 回复4 | 2010-12-22 14:30:26 | 显示全部楼层 |阅读模式
student表(学生表)
学号 姓名 性别 年龄 系别
1 吴好 男 18 计算机系
2 崔平 女 21 经管系
3 钱筱 女 19 电子系
course表(课程表)
课程号 课程名 学分
1 SQL Server 4
2 数据结构 3
3 专业英语 2
sc表(成绩表)
学号 课程号 成绩
1 1 88
2 1 90
2 2 70
3 3 79
1、 把course表中课程号为3的课程的学分修改为3。(3分)
2、 在student表中查询年龄大于18的学生的所有信息,并按学号降序排列。(4分)
3、 在以上三个表中查询选的课程的“学分”为3,并且成绩大于80的学生的学号、姓名和性别。(6分)
4、为student表创建一个名称为my_trig的触发器,当用户成功删除该表中的一条或多条记录时,触发器自动删除sc表中与之有关的记录。(7分)

回复

使用道具 举报

千问 | 2010-12-22 14:30:26 | 显示全部楼层
题目呢?没有题怎么回答。 补充回答update course set 学分 =3 where 课程号=3select * from student where 年龄>18 order by 学号 descselect s.学号,s.姓名,s.性别 from student s inner join sc on sc.学号= s.学号 inner join course c on sc.课程号 on c.课程号 where c.学分=3 and sc.成绩>30group by s.学号,s.姓名,s.性别这个查询会比用in查询快一些。create trigger my_trig on studen
回复

使用道具 举报

千问 | 2010-12-22 14:30:26 | 显示全部楼层
1.update sc set 成绩=3 where 课程号=32.select * from student where 年龄>18 order by 学号3.select 学号,姓名,性别 from student,course,sc where student.学号=sc.学号 and course.课程号=sc.课程号 and 学分=3 an
回复

使用道具 举报

千问 | 2010-12-22 14:30:26 | 显示全部楼层
1. update course set 学分=3 where 课程号=32. select * from student where 年龄>18 order by 学号 desc3. select 学号、姓名,性别 from student join sc on student.学号=sc.学号 where 成绩>80 and 课程号 in (se
回复

使用道具 举报

千问 | 2010-12-22 14:30:26 | 显示全部楼层
一年前我会,现在忘啦
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行