多個相同結構的表,將資料導到乙個表中

2021-06-28 08:38:53 字數 1655 閱讀 9315

mysql中嘗試:

insertinto資料庫名.表名

select*from資料庫名.表名

-- 同一伺服器

-- 全部插入

insertintodatabaseone.dbo.userinfo

select*fromdatabasetwo.dbo.userinfo

-- 主鍵或某個欄位不插入

insertintodatabaseone.dbo.userinfo(col1,col2,col3)

selectcol1,col2,col3

fromdatabasetwo.dbo.userinfo

-- 不同伺服器

-- 全部插入

insertinto[192.168.1.1]databaseone.dbo.userinfo

select*fromdatabasetwo.dbo.userinfo

-- 主鍵或某個欄位不插入

insertinto[192.168.1.1].databaseone.dbo.userinfo(col1,col2,col3)

selectcol1,col2,col3

fromdatabasetwo.dbo.userinfo

-- 基本

insertinto資料庫名.dbo.表名

select*from資料庫名.dbo.表名

-- 基本ip   可以先建好鏈結伺服器

insertinto[ip位址].資料庫名.dbo.表名

select*from[ip位址].資料庫名.dbo.表名

oracle將乙個表資料插入到另乙個表

一 插入部分表資料,示列 將table name new表中五個字段對應插入到table name表中,where後面是條件判斷可去掉 where forgid 0 插入指定行資料 insert into table name t t.val1,t.val2,t.val3,t.val4,t.val5...

SQL 將兩個結構相同的表合併到成乙個表

select into 新錶名 from select from t1 union all select from t2 這個語句可以實現將合併的資料追加到乙個新錶中。不合併重複資料 select from t1 union all select from t2 合併重複資料 select from...

mysql將乙個表拆分成多個表

有乙個5000條資料的表,要把它變成每1000條資料乙個表的5等份。假設 表名 xuesi 主鍵 kid xuesi共有5000條資料,kid從1到5000自動增長 題目 將xuesi分成5個表 每個表1000條不同的資料 方法1 create table xuesi1 select from xu...