您的位置:首页 > 数据库 > Oracle

ORACLE中通过SQL语句(alter table)来增加、删除、修改字段

2017-01-17 17:36 651 查看
1.添加字段:

alter table 表名 add (字段 字段类型) [ default '输入默认值'] [null/not null] ;

2.添加备注:

comment on column 库名.表名.字段名 is '输入的备注'; 如: 我要在ers_data库中 test表 document_type字段添加备注 comment on column ers_data.test.document_type is '文件类型';

3.修改字段类型:

alter table 表名 modiy (字段 字段类型 [default '输入默认值' ] [null/not null] ,字段 字段类型 [default '输入默认值' ] [null/not null] ); 修改多个字段用逗号隔开

4.删除字段:

alter table 表名 drop (字段);

https://s.click.taobao.com/yQUQLBx
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: