1. 程式人生 > >在數據庫原表中增加字段

在數據庫原表中增加字段

ber nbsp modify rename table 一個 lec 假設 alt

假設你的表為 table1

字段列表為:
a varchar2(5)
b char2(10)
c number(2)

如果你想把表變成
a varchar2(5)
new_d varchar2(100)
b char2(10)
c number(2)


那麽你需要:

1、這樣創建一個表:
create table table2 as select a,‘NULL‘ as new_d,b,c from table1;

2、這樣修正這個表:
alter table table2 modify (new_d varchar2(20))

3、刪掉原來的表:

drop table table1;

4、修改當前的表名:

rename table2 to table1;

在數據庫原表中增加字段