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);