首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

oracle,mysql,db2批改列比较

2012-09-27 
oracle,mysql,db2修改列比较(转自:http://www.54xue.com/w/18/n-4818.html)1,增加列:相同alter table test

oracle,mysql,db2修改列比较
(转自:http://www.54xue.com/w/18/n-4818.html)

1,增加列:相同
alter table test add mail varchar(128);

2,删除列:
oracle 与mysql相同:alter table test drop column mail;
db2              :不提供删除列功能(解决办法是删除表,重建)

3,更改列名
oracle : alter table test rename column mail to mail2;
mysql  : alter talbe test change mail mail2 varchar(128);
db2    : 不提供更改列名功能(解决办法同删除,或者通过建立一个新视图解决)

4,更改列类型
oracle :alter table test modify column (mail2 integer);
mysql  :alter table test modify column mail2 integer;
db2    :alter table test alter mail varchar(256) 只可以加宽,不能更改类型

5,更改列的限制(主键、非空)
db2  :alter table test alter mail null/not null;
mysql :alter table test modify mail2 varchar(29) not null;
oracle:alter table test modify mail2 null/not null;

热点排行