数据库操作3


插入 几条老师信息 和成绩、用SQL插入几条员工信息(注意:bit类型,在写代码中用1或0来表示,不要用’false’,会进行类型转换的。)
练习1:给studentId是1的英语成绩加10分

练习2:考试题偏难,所有人的成绩加5分

练习3:所有女学生的年龄减1岁

删除工资大于2000的老师

============将老师表清空========
删除所有老师
删除数据时候  把自增长列的值还原成种子


1.update TblScore set tEnglish=tEnglish+5 where studentId=1

2.(第一种方法)update TblScore set tEnglish=tEnglish+5 where tEnglish+5<=100

update TblScore set tMath=tMath+5 where tMath+5<=100

update TblScore set tEnglish=100 where tEnglish+5>=100

update TblScore set tMath=100 where tMath+5>=100

(第二种方法)

update Score
set english=
(
case when english+5<=100 then english+5
when english+5>=100 then 100
end
),
math=
(
case when math+5<=100 then math+5
when math+5>=100 then 100
end
)

3.update TblStudent set tTAge=tTAge-1 where tTGender='女'

4. delete from TblTeacher where tTSalary>2000

5. delete from TblTeacher

6. drop table TblTeacher

7.truncate table TblTeacher;
insert into TblTeacher VALUES('李四',1,20,10000,'2000-10-10');

 



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值