創建表結構:
create table test1
(id varchar2(20) not null);
向表中添加主鍵約束
alter table test1 add constraint pk_test1 primary key(id);
向表中添加Sequences
create sequence SEQ_TX_ASKCUSTTYPE
minvalue 1
maxvalue 999999999999999999999999999
start with 1
increment by 1
nocache;
添加字段的語法:
alter table test1 add (column datatype [default value][null/not null],….);
修改字段的語法:
修改列的名稱
alter table TABLE_NAME rename column FIELD_NAME to NEW_FIELD_NAME;
修改列的屬性
alter table test1 modify (column datatype [default value][null/not null],….);
刪除字段的語法:
alter table test1 drop (column);
添加、修改、刪除多列的話,用逗號隔開。
alter table test1 add (
name varchar2(30) default ‘無名氏' not null,
age integer default 22 not null,
has_money number(9,2)
);