MySQL inserts the data queried in Table a into Table B. mysql

Source: Internet
Author: User

MySQL inserts the data queried in Table a into Table B. mysql

MySQL inserts the data queried in Table a into Table B.

If table B exists

insert into b select * from a;

If table B does not exist

create table b as select * from a;

Extension:

Insert a write segment value in Table B to Table.

insert into a (userID,userName) select b.userID,b.userName from tr_ajax_chat_messages;

Save the userID values of table a and table B to Table.

update a set a.userName=(select b.userName from b where a.userID = b.userID);



Insert the query results of one table into another table (oracle, mysql, SQL, and GP)

If the table exists:
Insert into tab1 select * from tab2;
If the table does not exist:
Create table tab1 as select * from tab2;

How does mysql move table 1 of database a to database B?

For php, use phpmyadmin to export table 1 to the. SQL file and then import it to database B.

For jsp, you can use mysql-front, a visual mysql database operating system. You can export table 1 and import it to database B.

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.