To copy data from one table to another in MySQL, you can use the INSERT INTO SELECT statement. Here is an example:
Suppose you have two tables named “table1” and “table2” and you want to copy all the data from “table1” to “table2”. You can do so using the following SQL query:
INSERT INTO table2 (column1, column2, column3, ...)
SELECT column1, column2, column3, ...
FROM table1;
In this query, you need to replace “column1, column2, column3, …” with the actual column names of the tables. This query will insert all the data from “table1” into “table2”.
亿速云「云数据库 MySQL」免部署即开即用,比自行安装部署数据库高出1倍以上的性能,双节点冗余防止单节点故障,数据自动定期备份随时恢复。点击查看>>