暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

Mysql的一些命令 更新数据

周周小心得 2021-05-07
891

更新数据

语法:

update  表名 set 字段1名字 = 字段1的值,字段2名字 = 字段2的值 where 条件


更新所有数据

#(1)将所有人的成绩 设置为100

update tb_user set score=100;


根据条件更新

#(2)将学号是6的学生,成绩设为59

update tb_user set score=59 where id=6;


更新多个字段

#(3)将名字为ww的学生,成绩设置60

update tb_user set score=59 where name='ww';

#(4)将学号是5的学生,成绩设置为99,名字“xl”

update tb_user set score=99,name = 'xl' where id=5;

#(5)将所有人的成绩,减去10分。

update tb_user set score = score*0.7;

update tb_user set score = score-10;


文章转载自周周小心得,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论