自学内容网 自学内容网

kingbaseESV8修改表

--修改表的schema
alter table exam.score set schema new_schema;
--修改表名
alter table xxx rename to new_xxx;
--修改约束名
alter table xxx rename constraint fk_1 to fk_2;

--建表like语法
create table t02 (like t01 including default including constrains including indexes);
create table new_schema.studetlike (like exam.student including all);

--表所在的表空间
select table_name,tablespace_name from dba_tables;

mkdir tbs01;
mkdir tbs02;
--创建表空间
create tablespace tbs01 location '/home/kingbase/tbs01';
create tablespace tbs02 location '/home/kingbase/tbs02';
--修改表空间
alter table exam.course set tablespace tbs01;
select table_name,tablespace_name from dba_tables t where t.table_name = 'COURSE';
--迁移表空间中的所有表
alter table all in tablespace tbs01 set tablespace sys_default;

--修改列类型
create table aaa (id char(1));
alter table aaa alter column id type int;
--删除表
drop table if exists aaa;

--事务结束保留记录
create temporary table temp01(id int primary key,name text) on commit preserve rows;
--事务结束清除记录
create temporary table temp02(id int primary key,name text) on commit delete rows;
--事务结束删除临时表
create temporary table temp02(id int primary key,name text) on commit drop;


原文地址:https://blog.csdn.net/fishv668/article/details/136996505

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!