表字段修改
修改表字段默认值
alter table 表名 modify 字段名 default 默认值;
alter table tablename modify create_time default sysdate;
添加字段
alter table user add (user_name varchar(50) default '默认字段' not null);
给字段添加注释说明
comment on column 表名.字段名 is ‘注释内容’;
comment on column T_STUDENT.NAME
is '学生名';
修改字段数据类型(长度)
alter table 表名 modify 字段名 数据类型;
alter table T_STUDENT modify name varchar2(20);
从一张表复制表结构到新表
create table newtable as select * from oldtable where 1=2
从一张表复制表结构到新表(包括数据)
create table newtable as select * from oldtable