目录
2.更新教师表中教师号在T5到T8之间的记录,将津贴改为1500
3.更新授课表中周数为8的记录,将教师号改为T7,课程号改为C1
4.更新课程表中课时数不在45,50中的记录,将课时数改为25
5.更新教师表中工资不等于3000并且津贴不为空的记录,将津贴改为1000
6.更新授课表中教室号在J102,Y104,Y303,J301中的记录,将周数改为14,课程号改为C5
7.更新教师表中工资等于2000并且岗位津贴大于等于1000的记录,将津贴改为500
8.更新课程表中带课程名称以字母“M”开头并且课程名称中有“L”字母的记录,将课时数改为78
9.更新授课表中教室在Y栋2楼的记录,将课程号改为C8,教师号改为T10
1.更新教师表中所有记录,将津贴改为2000
update teacher set comm=2000;
编辑
2.更新教师表中教师号在T5到T8之间的记录,将津贴改为1500
update teacher set comm=1500 where no between "T5" and "T8";
编辑
3.更新授课表中周数为8的记录,将教师号改为T7,课程号改为C1
update schoolteaching set teacher_no = "T7",course_no = "C1" where week=8;
编辑
4.更新课程表中课时数不在45,50中的记录,将课时数改为25
update course set
-> class_hours=25 where
-> class_hours not in (45,50);
编辑
5.更新教师表中工资不等于3000并且津贴不为空的记录,将津贴改为1000
update teacher set
-> comm=1000
-> where sal!=3000 and comm is not null;
编辑
6.更新授课表中教室号在J102,Y104,Y303,J301中的记录,将周数改为14,课程号改为C5
update schoolteaching set
-> week =14,course_no = "C5"
-> where class_num in ("J102","Y104","Y303","J301");
编辑
7.更新教师表中工资等于2000并且岗位津贴大于等于1000的记录,将津贴改为500
update teacher set
-> comm=500 where
-> sal=2000 and comm>=1000;
编辑
8.更新课程表中带课程名称以字母“M”开头并且课程名称中有“L”字母的记录,将课时数改为78
update course set
-> class_hours=78 where
-> name like "M%" and name like "%l%";
9.更新授课表中教室在Y栋2楼的记录,将课程号改为C8,教师号改为T10
update schoolteaching set
-> course_no = "C8",teacher_no = "T10"
-> where class_num like "Y2%";
编辑
内容总结
更新一个表的数据,首先要知道数据是哪个表的哪个字段的,然后先进行更改再进行条件限制