MySQL copy data from one table to another table in SQL statement

Source: Internet
Author: User
Tags one table

This section is looking for a new job, today's interview, to do a set of questions, which encountered such a sentence, copy all the data from one table to another table of SQL?

Originally I rarely use, also did not pay attention to this problem, after interview I surf the internet to check, come back to write with my own hand, test under, indeed have. Now I'm recording.

This statement is: INSERT INTO A select * from B; This statement changes according to needs, the field must be consistent;

The other is MySQL copy table structure and data to a new table: CREATE table new Table SELECT * from old table; example SQL statement: CREATE TABLE new_table SELECT * from old_table

MySQL copy data from one table to another table in SQL statement

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.