如何修改数据库表中的某一个字段的值

如题所述

修改方法:

使用update语句。语法是:update table_name set column = value[, colunm = value...] [where condition];


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


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

具体操作方法:

a lter table table_name add xxoo number(4) default 0 ;

因此 不仅要修改字典, 还要刷新全部数据.

1) 在ALTER sql中有带缺省值,ORACLE 会直接刷新全部的记录。

2) 在ALTER sql中没有带缺省值,ORACLE 只会影响到后来的记录。

1 2 3 4 alter table table_name add xxoo number(4) default null; Table altered,Executed in 0.062 seconds。

带有default null 就可以了?,1 2 3 4 alter table table_name add xxoo number(4) default 0;Table altered,Executed in 1.625 seconds,原来的话 要更新所有的行, 会导致UNDO 段占用

使用语句Alter table a add test number(10) default 0;更新一个大表中字段时,表有四个分区,数据达到几十亿行,增加一个字段竟然要几个小时的时间,修改语句加上Nologging ,怎么没有作用呢?去找是不是哪有锁了呢,使用语句 select *。

温馨提示:答案为网友推荐,仅供参考
第1个回答  推荐于2017-11-22
使用update语句。语法是:update table_name set column = value[, colunm = value...] [where condition];
[ ]中的部分表示可以有也可以没有。
例如:update students set stu_name = "zhangsan", stu_gender = "m" where stu_id = 5;本回答被网友采纳
相似回答