如何用一条SQL语句实现,克隆一张表。 就是根据数据库里原有的一张表结构,再建一张一摸一样的表,只是表名不同,怎么用一条SQL语句实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 create table tablename as select * from tablesourcename create table tablename as select * from tablesourcename where 1=0这样只复制结构,不复制数据 复制表create table ttt as (select * from a); 只是结构的话,可以通过create table tablename as select * from table;实现。但是,这样只能够复制数据和结构。表中用到的分区和索引以及主外件等,都需要重新建的。 还快哟。上面的可以复制表的字段定义以及表中的数据,不过最好的方式还是通过dbms)metadata.get_ddl('TABLE', 'Tablename', 'schemaname')获得sql,修改后新建table。然后在使用insert table tablename select * from originalTablename;上面建了和结构一样,下面保证数据一样。 create table new_table asselect * from old_table create table 新表名asselect 子句;例如;create table table_newnameasselect * from table_oldname 求教 这个SQL的意思 运行这个的时候报值过多是什么意思呢 怎么在视图和存储过程,动态创建一个临时视图? 求助:求指导数据搬迁SQL如何写 substr用法 查询子句中索引有顺序吗? 急,高分,怎样将一个.xml文件导入到数据库中? ORACLE中的存储过程对前台程序有什么用?举例说明200分,此贴在PB区也有。谢谢。 急,数据导出,导入!!!!! 表空间与数据文件是一个什么样的关系? 利用Oracle的EXP命令导出问题 求Oracle 9208不停机或尽量短时间停机升级到11.1.0.7的方案
as select * from tablesourcename
as select * from tablesourcename where 1=0
这样只复制结构,不复制数据
create table ttt as (select * from a);
但是,这样只能够复制数据和结构。表中用到的分区和索引以及主外件等,都需要重新建的。
还快哟。上面的可以复制表的字段定义以及表中的数据,不过最好的方式还是通过dbms)metadata.get_ddl('TABLE', 'Tablename', 'schemaname')获得sql,修改后新建table。然后在使用insert table tablename select * from originalTablename;上面建了和结构一样,下面保证数据一样。
as
select * from old_table
create table 新表名
as
select 子句;例如;
create table table_newname
as
select * from table_oldname