怎么对mysql数据表中的某个字段的所有数据修改

如题所述

对mysql数据表中的某个字段的所有数据修改,可以使用update语句,语法是:

update table_name set column = value[, colunm = value...] [where condition];

[ ]中的部分表示可以有也可以没有。

例如:

update students set stu_name = "zhangsan", stu_gender = "m" where stu_id = 5;

扩展资料:

SQL修改字段属性总结:

1、修改表中字段类型 可以修改列的类型,是否为空)

Alter table [表名] alter column [列名] 类型

2、向表中添加字段

Alter table [表名] add [列名] 类型

3、删除字段

Alter table [表名] drop column [列名]

4、添加主键

Alter table [表名] add constraint [ 约束名] primary key( [列名])

5、添加唯一约束

Alter table [表名] add constraint [ 约束名] unique([列名])

6、添加表中某列的默认值

Alter table [表名] add constraint [约束名] default(默认值) for [列名]

温馨提示:答案为网友推荐,仅供参考
第1个回答  2017-08-14
怎么对mysql数据表中的某个字段的所有数据修改
使用update语句。语法是:update table_name set column = value[, colunm = value...] [where condition];
[ ]中的部分表示可以有也可以没有。
例如:update students set stu_name = "zhangsan", stu_gender = "m" where stu_id = 5;
第2个回答  2017-08-14
update 表名 set 字段名=修改后的值 where 1本回答被提问者采纳
相似回答