数据库MySQL中更新数据库update
发布日期:2021-05-07 13:27:43 浏览次数:18 分类:精选文章

本文共 398 字,大约阅读时间需要 1 分钟。

更新数据update

语法:

update表名 set字段1名字=字段1的值,字段2名字=字段2的值 where 条件。
更新所有数据

(1)将所有人的成绩 设置为100update tb_user set score=100;

根据条件更新

(1)将学号是6的学生,成绩设为59;Update 表名 set score=59 where id=6;(2)将名字为ww的学生,成绩设置60;Update 表名 set score=60 where name=”ww”;(3)将学号是5的学生,成绩设置为99,名字“xl”;Update 表名 set score=99,name = “xl” where id =5;

更新多个字段

(1)将所有人成绩,减去10分Update 表名 set score = score * 0.7;Update 表名 set score = score - 10;
上一篇:数据库MySQL中删除数据delete及Truncate和delete之间的区别!
下一篇:数据库MySQL中的插入数据

发表评论

最新留言

很好
[***.229.124.182]2025年04月05日 17时55分55秒