云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > 《SQL - Server - 2000 - 实验指导》课后作业

《SQL - Server - 2000 - 实验指导》课后作业

  • 62 次阅读
  • 3 次下载
  • 2025/6/15 12:43:19

- 36 -

5、创建一个角色newstudent,使其具有对数据库jiaoxuedb进行任何操作的权限。并将上面创建的用户:newuser、sqladmin、sqlteacher添加到此用户中。

- 37 -

- 38 -

实验13:习题

1、编写一个事务:对于考试违纪的学生,对其采取考试成绩降一个档次的处罚。考试成绩分为5档次:优、良、中、及格、不及格。 begin transaction use jiaoxuedb go

select sno,cno,grade=

case when score<60 then '不及格'

when score<70 and score>=60 then '及格' when score<80 and score>=70 then '中等' when score<90 and score>=80 then '良好' when score>=90 and score<=100 then '优秀' end

from sc where flag=0 union

select sno,cno,grade=

case when score-10<60 then '不及格'

when score-10<70 and score>=60 then '及格' when score-10<80 and score>=70 then '中等' when score-10<90 and score>=80 then '良好' end

from sc where flag=1 commit

2.对于发生教学事故的教师要进行罚款处理,假如用x表示罚款数额。编写一个罚款事务,要求:从被罚款的教师工资中扣除罚款额x,若工资额大于等于罚款额x,则提交罚款,否则,扣除工资的一半作为罚款额,剩余罚款额以后再扣除,并修改显示剩余的罚款额x。 begin transaction use jiaoxuedb declare @pay int,@name char(10),@sal int set @pay=1000 set @name='李英' select @sal=sal from teacher where tn=@name if @sal>@pay begin update teacher set sal=sal-@pay where tn=@name select @sal=sal from teacher where tn=@name print @name+'经过处罚后还剩余的工资为:'+str(@sal) commit end else begin update teacher set sal=sal-sal/2 where tn=@name - 39 -

select @pay=@pay-sal from teacher where tn=@name print @name+'还欠款'+str(@pay) end go 3.完成下面事务设计:某高校嘉奖优秀教师:增加津贴500元;若此教师为助教,则可破格将其晋升为讲师。获得优秀教师的条件是:至少任两门课课程,并且每门课程的及格率100%,优秀率33%。 4.设计一个事务,给所有在册的非新生学生增加1岁,要求,50人作为一个事务提交一次。

- 40 -

搜索更多关于: 《SQL - Server - 2000 - 实验指导》课后 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

- 36 - 5、创建一个角色newstudent,使其具有对数据库jiaoxuedb进行任何操作的权限。并将上面创建的用户:newuser、sqladmin、sqlteacher添加到此用户中。 - 37 - - 38 - 实验13:习题 1、编写一个事务:对于考试违纪的学生,对其采取考试成绩降一个档次的处罚。考试成绩分为5档次:优、良、中、及格、不及格。 begin transaction use jiaoxuedb go select sno,cno,grade= case when score<60 then '不及格' when score<70 and s

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com