Oracle和MySQL修改字段

一、修改字段名:

Oracle:

ALTER TABLE tableName RENAME COLUMN oldColumnName TO newColumnName; 

eg: ALTER TABLE web RENAME COLUMN wen_name TO web_name; 

MySQL:

ALTER TABLE tableName CHANGE oldColumnName newColumnName newColumnDataType;

eg: ALTER TABLE bonus CHANGE ename empname VARCHAR(50);

二、修改字段长度:

Oracle:

ALTER TABLE tableName MODIFY columnName newDataType; 

eg: ALTER TABLE web MODIFY web_id NUMBER(6); 

MySQL:

ALTER TABLE tableName MODIFY COLUMN columnName newDataType;

eg: ALTER TABLE bonus MODIFY COLUMN ename VARCHAR(100);

 三、增加字段:

Oracle:

ALTER TABLE tableName ADD coloumnName dataType;

eg: ALTER TABLE web ADD status CHAR(1);

posted @ 2013-06-27 18:23  Wolfe Yu  阅读(326)  评论(0编辑  收藏  举报
QQ:379382995
手机:15942886891
邮箱:379382995@qq.com