如何在Oracle中複製表結構和表資料

2021-05-22 16:13:46 字數 474 閱讀 6726

1. 複製表結構及其資料:

create table table_name_new as select * from table_name_old

2. 只複製表結構:

create table table_name_new as select * from table_name_old where 1=2;

或者:

create table table_name_new like table_name_old

3. 只複製表資料:

如果兩個表結構一樣:

insert into table_name_new select * from table_name_old

如果兩個表結構不一樣:

insert into table_name_new(column1,column2...) select column1,column2... from table_name_old

如何在Oracle中複製表結構和表資料

如何在oracle中複製表結構和表資料 1.複製表結構及其資料 create table table name new as select from table name old 2.只複製表結構 create table table name new as select from table na...

如何在Oracle中複製表結構和表資料

1.複製表結構及其資料 create table table name new as select from table name old 2.只複製表結構 create table table name new as select from table name old where 1 2 或者 ...

oracle 複製表與複製表結構

一 複製表的語法 create table 表名稱 as 子查詢 例子 複製oracel安裝後的預設資料庫scott中的表emp create table myemp as select from emp 此例是表示表結構和表內容一起複製過來了。二 複製表結構 create table 表名稱 as...