oracle添加字段或者删除字段-转载

Posted AlisonGavin

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了oracle添加字段或者删除字段-转载相关的知识,希望对你有一定的参考价值。

添加字段的语法:alter table tablename add (column datatype [default value][null/not null],….);

修改字段的语法:alter table tablename modify (column datatype [default value][null/not null],….);

删除字段的语法:alter table tablename drop (column);

 

例子:

使用一个SQL语句同时添加三个字段:

代码如下:

alter table test1
add (
  name varchar2(30) default ‘无名氏‘ not null,
  age integer default 22 not null, 
  has_money number(9,2)

);

修改一个字段

 代码如下: 
alter table test1
modify (name varchar2(16) default ‘unknown‘);

  

 

以上是关于oracle添加字段或者删除字段-转载的主要内容,如果未能解决你的问题,请参考以下文章