數據遷移 mysql

相同數據庫遷移

insert into table1 select * from table2  # 完全複製

insert into table1 select distinct * from table2 # 不復制重複紀錄

insert into table1 select top 5 * from table2  # 前五條紀錄

insert into table1(a,b,c) select a,b,c from table2 # 插入指定字段值

跨庫遷移數據

insert into db1.table1 select * from db2.table2  #完全複製

insert into db1.table1 select distinct * from db2.table2 # 不復制重複紀錄

insert into db1.table1 select top 5 * from db2.table2  # 前五條紀錄
insert into db1.table1(a,b,c) select a,b,c from db2.table2 # 插入指定字段值
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章