Categories
Tools

How to Copy data from one MySQL table to another

Last updated on August 7th, 2022 at 06:58 pm

Click to rate this tutorial!
[Total: 1 Average: 5]

This code will help us copy content from one table to another, we can use single column or multiple according to your requirement.

Let us assume the table with the name table_1 and we would like to copy column named email from that table to another table with the name table_2.

INSERT INTO table_2 (email) SELECT email FROM table_1 WHERE email='[email protected]';

As you can see both have the same column named email. It is not mandatory to have the same column name but make sure you specify the name of the column in the INSERT command as shown

Click to rate this tutorial!
[Total: 1 Average: 5]

Leave a Reply

Your email address will not be published.