创建表:
create table t1(key1 type default 0,key2 type not null)
删除表:
drop table t1;
删除表数据:
truncate table t1;
增加列:
alter table t1 add f3 type;
删除列:
alter table t1drop column f3;
修改列类型:
alter table t1 modify f3 new_type;
增加/删除唯一性:
alter table t1 add/drop unique(key2);
增加/撤销主键:
alter table t1 add/drop primary key(key1);
alter table t1 drop primary key;
增加/删除检查:
alter table t1 add constraint c check(key1>0);
alter table t1 drop constraint c;
所有constraint都可以到下表查询:
select *from dba_cons_column where table_name=upper('t1');
增加/删除默认值:
alter table t1 modify f1 default 0/null;
创建view:
create view v1 as select * from t1;
创建更新视图:
create or replace v1 as select f1,f2 from t1;
删除视图:
drop view v1;
创建表索引:
create index index1 on t1(f1,f2);
删除表索引:
drop index index1;
创建表空间:
create tablespace tsName datafile '/opt/ts.dbf' size 1G autoextend on;
alter database datafile '/opt/ts.dbf' autoextend on;
查询表空间和文件关系:
select tablespace_name,file_name from dba_data_files;