时间:2021-07-01 10:21:17 帮助过:38人阅读
我们可以先把test下的t1表的结构导出来,然后新建立一个test1.t1表。
执行下面语句
insert into test1.t1 select * from test.t1 limit 2 (limit限制条数)
如果在一个数据库中就是
insert into t1 select * from t2 limit 2
如果表结构不一样的两张表,可以考虑、、参考下面的语句
INSERT into db_ds_edu.t_exam_student(stu_id,stu_number,stu_name,school_id,campus_id,grade_id,class_id,xuebu_id) SELECT stu.id , stu.student_num ,person.name , stu.school_id , stu.campus_id , stu.grade_id , stu.clas_id , stu.xuebu_id FROM db_ds.t_stu_info AS stu ,db_ds.t_p_person_info as person WHERE stu.person_id = person.id
insert into test1.t1 select * from test.t1 limit 2