Oracle 復制表內(nèi)數(shù)據(jù),復制表結構 |
發(fā)布時間: 2012/8/23 16:39:45 |
(1)復制表結構,同時復制表內(nèi)數(shù)據(jù)。 create table 表1 as select * from 表2; (2)復制表結構。 create table 表1 as select * from 表2 where 1<>1 ; 當然,關于where字句,也可以是:1=2,1=3等等。 - 1、只復制表結構的sql create table b as select * from a where 1<>1 2、即復制表結構又復制表中數(shù)據(jù)的sql create table b as select * from a 3、復制表的制定字段的sql create table b as select row_id,name,age from a where 1<>1//前提是row_id,name,age都是a表的列 4、復制表的指定字段及這些指定字段的數(shù)據(jù)的sql create table b as select row_id,name,age from a 以上語句雖然能夠很容易的根據(jù)a表結構復制創(chuàng)建b表,但是a表的索引等卻復制不了,需要在b中手動建立。 5、insert into 會將查詢結果保存到已經(jīng)存在的表中 insert into t2(column1, column2, ....) select column1, column2, .... from t1 本文出自:億恩科技【www.laynepeng.cn】 |