Oracle,Mysql,DB2修改列比较(转)
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;
1,增加列:相同
![微笑](http://static.blog.csdn.net/xheditor/xheditor_emot/default/smile.gif)
2,删除列:
![吐舌头](http://static.blog.csdn.net/xheditor/xheditor_emot/default/tongue.gif)
![偷笑](http://static.blog.csdn.net/xheditor/xheditor_emot/default/titter.gif)
3,更改列名
![生气](http://static.blog.csdn.net/xheditor/xheditor_emot/default/mad.gif)
![快哭了](http://static.blog.csdn.net/xheditor/xheditor_emot/default/fastcry.gif)
![委屈](http://static.blog.csdn.net/xheditor/xheditor_emot/default/wronged.gif)
4,更改列类型
![生气](http://static.blog.csdn.net/xheditor/xheditor_emot/default/mad.gif)
![快哭了](http://static.blog.csdn.net/xheditor/xheditor_emot/default/fastcry.gif)
![委屈](http://static.blog.csdn.net/xheditor/xheditor_emot/default/wronged.gif)
5,更改列的限制(主键、非空)
![委屈](http://static.blog.csdn.net/xheditor/xheditor_emot/default/wronged.gif)
![快哭了](http://static.blog.csdn.net/xheditor/xheditor_emot/default/fastcry.gif)
oracle:alter table test modify mail2 null/not null;