簡體   English   中英

如何將數據從一個表復制到另一表?

[英]How do i copy data from one table to another table?

我有2個表格,分別是ff模式和國家/地區:

country               division
-----------           ------------
countrycode           divisioncode
contryname           countrycode
                      divisionname

我想將數據從國家/地區表復制到部門表中,其中國家/地區代碼進入部門代碼,國家/地區代碼進入部門表,國家名稱進入部門名稱

例如,美國-美國作為美國,美國,美國進入除法表。

使用INSERT INTO ... SELECT

詢問

INSERT INTO division(divisioncode, countrycode, divisionname)
SELECT countrycode, countrycode, countryname
FROM country;
insert into division (divisioncode, countrycode, divisionname)
select t1.countrycode, t1.countrycode, t1.countryname
from country t1

參見: http : //dev.mysql.com/doc/refman/5.7/en/insert-select.html

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM