6:mysql表修改数据update

修改表数据语法

 

update 表名 set

col1=newval1,

col2=newval2,

...

...

colN=newvalN

where 条件;

 

  1. 修改单列
  2. update user set name='百度搜索付杰博客' where id='1';
  3. 修改多列
  4. update user set name='付杰个人博客',age='16' where id='1';
  5. 不加where条件
  6.  update user set age='16';

mysql表修改数据

注意事项:

1、update可理解为:改哪张表 ?你需要改哪几列的值 ?分别改为什么值 ?在哪些行生效 ?

2、数据是很宝贵的,如果我们 update 不加 where 条件 , 后果是很可怕的;不加where仅用于个人测试,项目实践中请勿用;

    A+
发布日期:2017年01月15日 15:42:48  所属分类:mysql教程
最后更新时间:2017-01-15 15:42:48
付杰
  • ¥ 98.0元
  • 市场价:198.0元
  • ¥ 498.0元
  • 市场价:498.0元
  • ¥ 69.0元
  • 市场价:99.0元
  • ¥ 15元
  • 市场价:15元

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: