Mysql的語句
我們可以先把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