六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 72|回复: 0

oracle与db2、mysql一些小小的区别

[复制链接]

升级  56%

8

主题

8

主题

8

主题

童生

Rank: 1

积分
28
 楼主| 发表于 2013-1-13 18:24:57 | 显示全部楼层 |阅读模式
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;
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表