【mysql】复制一张表的数据到另一张表
方法一:
拷贝表1的全部数据到表2
INSERT INTO table2 SELECT * FROM table1
1
拷贝第n条
INSERT INTO table2 SELECT * FROM table1 WHERE id=5
1
拷贝指定字段
INSERT INTO table2 ( name , price ) SELECT name , price FROM table1 WHERE id=5
1
2
方法二:
创建表3, 同时拷贝表1的数据和结构到表3
CREATE TABLE table3 SELECT * FROM table1
1
方法三:
创建表4,只拷贝表1的结构到表4,不拷贝数据
CREATE TABLE table4 LIKE table1
------------------------- A little Progress a day makes you a big success... ----------------------------