不同資料庫如何複製表資料

2021-08-09 07:16:31 字數 912 閱讀 4657

a.不同資料庫,資料的複製語句:

sql: insert into db1.table select * from db2.table2 (完全複製)

b.表機構相同且在同乙個資料庫(如:table1,table2)

sql: insert into table1 select * from table2(完全複製)

insert into table1 select distinct * from table2(不複製重覆記錄)

insert into table1 select top 5 * from table2(前五條記錄)

c.表不在同乙個資料庫中 (如:db1 table1,db2 table2)

sql: insert into db1.table1 select * from db2.table2(完全複製)

insert into db1.table1  select distinct * from db2.table2(不重覆記錄複製)

萬變不離其宗,上面可以滿足你的一切需求。

如果想複製表,可以右擊該錶選擇 最後乙個選項物件資訊,然後找到ddl,建表語句就一覽無餘了,後面的***。。。。。。。。。。。。。。

資料庫 複製表

資料庫把一張表完整無缺的複製到另外一張表中 簡單的 insert into 目標表 select from 原表 兩張表結構必須相同 這種方法限制太多 雖然文字多 但還是很明白的,一看就會 1 滑鼠右擊要複製的表,選擇 編寫表指令碼為 create到 新建查詢編輯器視窗 命令 2 在查詢編輯器視窗中...

資料庫 複製表

完全的複製mysql的資料表,包括表的結構,索引,預設值等 1 只複製表結構到新錶 create table 新錶 select from 舊表 或者create table 新錶 like 舊表 特殊注意區別兩種方法的不同 前一種方式是複製時的主鍵型別和自增方式是不會複製過去的,而後一種方式是把舊...

誇資料庫 複製表

0 假設我們在oradb1資料下,假設我們有乙個遠端資料庫oradb2,假設oradb2有表a.1 建立資料庫連線。公式為 create database link databaselinkname connect to username identified by password using d...