Oracle常見表操作
阿新 • • 發佈:2019-01-02
drop table test2;
create table test(
id integer not null,
name varchar2(100)
);
---可為空
alter table test modify (id null);
---不可為空
alter table test modify (id not null);
---新增表中的列 alter table + add子句
alter table test add (ceilphone varchar2(20));
---修改表中的列 alter table + modify子句,如果是不可為空,要先update,再修改
alter table test modify (ceilphone integer);
----刪除列
alter table test drop column ceilphone;
---重命名錶
alter table test rename to test2;
alter table a add test varchar2(50);
alter table a rename column cfyjsnr to cfjysnr;
alter table a modify cfyj varchar2(200);
alter table a drop column cfyjsnr;
create table test(
id integer not null,
name varchar2(100)
);
---可為空
alter table test modify (id null);
---不可為空
alter table test modify (id not null);
---新增表中的列 alter table + add子句
alter table test add (ceilphone varchar2(20));
---修改表中的列 alter table + modify子句,如果是不可為空,要先update,再修改
alter table test modify (ceilphone integer);
----刪除列
alter table test drop column ceilphone;
---重命名錶
alter table test rename to test2;
alter table a add test varchar2(50);
alter table a rename column cfyjsnr to cfjysnr;
alter table a modify cfyj varchar2(200);
alter table a drop column cfyjsnr;