5.MySQL增删改查(3)——修改元素

格式:

update [表名] set [列名] = [修改的值]

1.把某同学的数学成绩改成80;

update exam_result set math = 80 where name = ‘孙悟空’;

在这里插入图片描述
2.把所有同学的数学成绩减十分;

update exam_result set math = math-10;

在这里插入图片描述
3.把倒数三名的语文成绩加上5分;

update exam_result set chinese=chinese+5 order by chinese+math+english asc limit 3;

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/qq_45136189/article/details/113904334