Molet

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

Molet 数据库 2023-02-25 532浏览 0

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 (字段);

 

继续浏览有关 数据库技术文章/教程 的文章
发表评论