Replication between mysql tables, same as databases and different databases

Source: Internet
Author: User

Replication between mysql tables, same as databases and different databases

Mysql statement

We can first export the structure of table t1 under test, and then create a new table test1.t1.

Execute the following statement

Insert into test1.t1 select * from test. t1 limit 2 (limit)

In a database



Insert into t1 select * from t2 limit 2

If the table structure is different for the two tables, consider, and refer to the following statements

 

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.