Mysql将一张表中的数据插入到另一张表中

一、 如果两张表(导出表和目标表)的字段一致

mysql> insert into student_part1 select * from student_part2;
Query OK, 4 rows affected (0.00 sec)
Records: 4  Duplicates: 0  Warnings: 0

二:字段不一致:

mysql> insert into student_part1(stu_no,stu_name,gender,score) select stu_no,stu_name,gender,score from student_part2;	
Query OK, 4 rows affected (0.00 sec)
Records: 4  Duplicates: 0  Warnings: 0

表student_part1:
在这里插入图片描述
表student_part2:
在这里插入图片描述
插入成功:
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_42172228/article/details/85235815