今天有些失落,因为可能真是犯了那个什么碎了
不过有些事情还是得去做,明天考oracle。。
为表增加一个字段
alter table a add address varchar2(10);
删除表的一个字段
alter table a drop column address;
alter table a drop column (address,id);删除多个字段。
设置字段不可用
alter table a set unused (address);
查看数据库中不可以用的字段
select * from user_unused_col_tabs;
alter table a drop unused column;删除不可用的字段。
调整表的参数
alter table t
pctfree 10
pctused 20;
移动表a到表空间user01_tbs
alter table a move
tablespace user01_tbs
storage(initial 10k
next 12k
pctincrease 10
maxextents unlimited);
手动分配存储空间,并且表大小有next参数设置,
alter table a allocate extent;
为表手动分配一个10k的新盘区
alter table a allocate extent (size 10k);
为表分配一个指定位置的盘区
alter table a allocate extent(size 1m
datafile 'E:/oracle/mytablespace/user_tbs.dbf');
创建一个表并指定表空间
create table 商品信息(商品编号 number,商品名称 varchar2(10),price number)
tablespace user01_tbs;
创建反向索引
create index merch_reverse_index
on 商品信息(商品编号) reverse
pctfree 30
tablespace user01_tbs;
创建基于函数的索引
create index function_index
on 商品信息(商品编号)
tablespace user01_tbs;
当用该列作为查询条件的时候,可以加快查询的速度。
为表增加一个主键
alter table spxx
add constraint pk_class_id
primary key (spno);